Accidentally copied folder and files into a single file - batch-file

An ms-dos backup batch file has copied all files and subfolders from a single folder into a single file on a usb stick. Is there any way we can extract theses files and folders from the single file that was created?

I believe what you probably did was the equivalent of
copy f1.txt d:\backup\backupfile
copy f2.txt d:\backup\backupfile
copy f3.txt d:\backup\backupfile
which, since backupfile isn't a directory, copied all 3 files, successively, to the file d:\backup\backupfile.
Unfortunately, this means that first f1.txt was copied to that file, then f2.txt, then f3.txt. Since each copy overwrote the file, I think you'll find that the contents of backupfile are equivalent to f3.txt (the last file that was backed up). If you have already deleted f1 and f2.txt, then they're gone.

Related

How to look at the contents of a zipped folder in batch?

In this case, I have a zip folder with contents inside. How would I look into the zip folder and be able to check the file name of those files for a certain word without having to unzip the file to begin with?
So for example:
I have a zip folder with the files inside named
123456789COW.txt
123445614COW.txt
123456789ASK.txt
232436787CAT.txt
and I want to check if the file has COW inside the name.
Every solution I have found so far has assumed I know the contents already, but in my case that may not always be true and I need to check.

Batch file to copy and rename the copied file

I would like to create a batch file to copy *.EXT files to the destination folder with appended date and time to file name and copy upto maximum 30 files. After 30 files are copied, should delete oldest file. (while copy the 31st file, the 1st file should be deleted, and so on).
Thanks for your support. Have a great day!

Navigating a Zipped Filesystem

I have found that, with some file zippers like 7-Zip, it is possible to use files inside the created archives. For example, if I create a file my-zip-file.7z, containing folder my-folder, with files this-file.docx and that-file.html I can use 7zip to go into my-zip-file.7z and open the 2 files, and see or change the contents, even if the original my-folder is deleted! How is this possible?
If you look at the file path for whatever you're editing you'll see that the document is saved to a temporary folder. When you save (or possibly close) 7-Zip then updates the zip file with the saved content.

Need to copy and rename files in different folders

would anyone know how to write a batch file (or two) that would:
copy hundreds of "index.html" files that are in different folders and keep within the same folder (so needs to search within sub folders)
rename the copies (keep the originals as is) to "index.jpg"
could anyone help?
I used a bulk rename tool to rename all index.html files to index.jpg in a copy of the main folder, then used robocopy to copy everything over, including the file structure back to the original folder (leaving the index.html's alone)

How to exclude a specific file from being copied using xcopy

I'm new to Windows batch files, but I'm writing a .bat file that just copies a bunch of files from one place to another maintaining the file directory structure. Using xcopy this is simple but I need to exclude some files from being copied. You can use /exclude and create a text file full of strings that you want to be excluded, but this doesn't just exclude files with the exact names in the text file, it excludes all files whose filenames contain any of the strings in the text file.
What this means is, if I want to exclude any files named 123.txt and put this string in my exclusions text file, if there was a file called 1123.txt anywhere in the source folder or any of its subfolders that would also be excluded.
How can I exclude only files with a specific filename from being copied?
Evening Bill.
Can you add a slash before each file name? That should work
EG
instead of
123.txt
blah.txt
use
\123.txt
\blah.txt
Try creating a temporary folder, xcopying all of the files into that folder, deleting the ones you don't want, then xcopying those to the final destination. Finally, delete the temporary folder and its contents with rd xyzzy /q/s

Resources