I'm using a batch script to output filenames with specific attributes to a .txt
file, in this case older than 30 days. I'd like to then zip or rar those files that are listed in the .txt
file.
How would I go about doing this?
I'm using a batch script to output filenames with specific attributes to a .txt
file, in this case older than 30 days. I'd like to then zip or rar those files that are listed in the .txt
file.
How would I go about doing this?
According to 7z command line options:
Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]
Since you've already have the list of files you can just use @
for that file. For example to compress files in filelist.txt
into test.zip, use the following command
7z a test.zip @filelist.txt
I've tried that and it worked perfectly
For RAR, just specify the file list in that place in the command line where you usually specify the list of files, but prefix it with "@" character.
For example, you have a list of files that you need to archive, in the list-of-files.txt
, one file
rar a archive-file @list-of-files.txt
RAR for MSDOS
ls.txt content :
C:\Users\xpacio\Desktop\001\foo.bin
C:\Users\xpacio\Desktop\002\foo.dat
in desktop exist :
001/foo.bin
001/bar.dat
002/foo.dat
002/bar.bin
Command:
rar a -m5 -ep1 -cu [email protected] result.rar C:\Users\xpacio\Desktop\
the comand, make a rar file named result.rar in the actual path.
the rar contents:
001/FOO.BIN
002/FOO.DAT
parameters:
-m5 max level of compression
-ep1 cut the path depth
-cu convert to UPPERCASE
[email protected] listo of files to process