Recovering lost documents from cmd moving - cmd

I was messing with the move command in Command Prompt, and I accidentally moved a file into a folder that didn't exist. When I tried 'dir', the invalid folder was listed, but it wasn't a directory, and it didn't show up under 'tree'. If I renamed the file as a .zip, it had folders within like _rels, docProps, and word, as well as [Content_Types].xml. Each folder contained several more xml files, but none had the document I had just misplaced. Is there a way to get it back or have I lost it permanently?

Ok, so basically what happend is that you tried to zip the .docx document, and then you got all of these folders. It simply what happens when you zip a word document.
There's nothing strange, you can just make it .docx again and it will be as normal.

Related

Move files to a folder if filename contains folder name

I am trying to move files of various extensions to a folder if the filename contains the folder name.
Simple example: I have several files such as Fox-1.doc, Fox-2.doc, etc. I have a folder named Fox. I'm trying to move the files into the folder Fox if folder name is contained in the filename.
I tried to modify the code in the following post but I was not successful.
Move files into existing folders containing part of the filename
Any pointers is appreciated.
If you are using code for doing this try getting the filename and filter from the .contains() method often found in Strings.
If you are using Linux command line I think this could work
mv *fox* destination_path/
For Powershell I found this thread that could help you:
powershell to move files based on part of file name
All you'd have to do is create the .ps1 with the modified script.

Files in Program files folder vanished

I have saved few files in Program files.When I checked again, the files are not seen. I tried searching the system with the file name, but it is not found.
How did the files disappear?
And is there a way to recover the files?

rsync with AppleScript, copy from other volume

I'm trying to build a automatic backup solution. My AppleScript commands are pretty simple. All I want to do is copy all the files in one folder to a different folder.
Currently I'm using this:
rsync --update -raz --progress Documents/test "Volumes/RFM_Projects_2"
This works when I have my files located in a folder called test in the Documents folder. Problem is that I have a different folder structure now where I have all the files I want to copy on a second internal harddrive.
I thought it would be easy to just change "Documents/test" to something like "Volumes/WORK/test", but this does not work at all.
Any ideas about how I can change the source location to a secondary harddrive?
All slash-delimited style paths, like the ones used in your rsync command, must start with a slash (/). That slash stands for the startup volume drive. I do not see that first slash in any of your paths so I'm surprised any of your code ever worked. Here's an applescript which will show you the path. Run this, select any folder you want, and copy/paste the result into your code. Note that if there are any spaces in any of your paths then you should put your paths in quotes in your rsync command.
choose folder
return POSIX path of result
Also note if you want the path to a file instead of a folder then change the word folder to file in the applescript. Good luck.

Windows incorrectly copying files by filename when in a Special Folder

If I copy a file from a special folder to the clipboard, change the location that special folder points to, and try to paste the file to this new location, Windows complains with a Item Not Found error, seemingly trying to copy the file by the filename alone.
The way I change the special folder location is with this line of C++ code:
SHSetKnownFolderPath(FOLDERID_Desktop, 0, NULL, new_location);
And a refresh to see the effect immediately:
SHChangeNotify(0x8000000, 0x1000, NULL, NULL);
Steps to reproduce
Desktop pointing to C:\Users\BoppreH\Desktop
Copy the file music 1.mp3 from the Desktop (C:\Users\BoppreH\Desktop\music 1.mp3)
Change location of the Desktop special folder to D:\music
The Desktop now shows the musics from D:\music
Try to paste music 1.mp3 on the Desktop
It fails with Item Not Found, complaining it could not find the file at D:\music\music 1.mp3, when the file is still happily sitting at C:\Users\BoppreH\Desktop\music 1.mp3. If I paste the file in any other folder that is not the Desktop, it works fine.
I know this is a case of Doctor, it hurts when I do this, and that constantly changing the location of the Desktop is extremely unusual behavior, but this is a feature I've grown to love and this bug constantly bites me.
Is there some workaround for this issue?
Use some type of folder watcher control to detect when the Special Folders location has changed and check the clipboard for any file paths that refer to the old location and update them.
Or change the location of the Specials before you copy the file.

DOS Commands- Excluding files in a folder in xcopy

I have a folder containing many other sub-folders.
I am trying to write a batch file which will copy some of the folders to another place on my hard disk. I am using "xcopy" for this. I am facing following problem:
The folder structure is as shown below-
--FolderB1
---FolderB2
---FolderB22
---File1.txt
---File2.txt
---File3.txt
I have some .txt files inside "FolderB1", along with "FolderB2" and
"FolderB22" I want to copy "FolderB2" and "FolderB22" and skip ".txt"
files contained in "Folder B1"
I tried using /EXCLUDE: param of xcopy command, but it is not able to perform this operation. It does not work if I specify the exclusion as \FolderB1\*.txt or something of this sort.
The number of main folders is not known. It can be anything. Also, there is no fix pattern for names of ".txt" files. Have checked this question too, but did not help.
Alternate method or other pointers for the same would be a great help. Thanks in advance.
What you could try to do is to hide the files you don't want to copy, then execute the xcopy, and then unhide the files again.
Look at my answer of question Windows batch script to delete everything in a folder except one. That question was related do deleting files (excluding some files), but you can probably use the same trick for xcopy-ing files.

Resources