Page 1 of 1

Archive a subfolder and delete it

Posted: 03 Mar 2020 09:52
by Nerakami
Hello

I've made a lot of research but i can't found the exact result that i need ...

I have for exemple :

Code: Select all

C:\folderA\subfolderToArchiveA
C:\folderB\subfolderToArchiveB
C:\folderC\subfolderToArchiveC
And i need to have

Code: Select all

C:\folderA\subfolderToArchiveA.rar
C:\folderB\subfolderToArchiveB.rar
C:\folderC\subfolderToArchiveC.rar
I've tried a code but it makes a global archive of every subfolderToArchiveX :/

And, i need to archive these subfolder only if they're older than 30 days

I'm new to batch, i can only archive a folder but i can't make it loop to every subfolder, any ideas ?

Re: Archive a subfolder and delete it

Posted: 03 Mar 2020 14:52
by penpen
Nerakami wrote:
03 Mar 2020 09:52
I've tried a code but it makes a global archive of every subfolderToArchiveX :/
Nice and beautiful code - i guess.

Nerakami wrote:
03 Mar 2020 09:52
And, i need to archive these subfolder only if they're older than 30 days
You could copy all files you need to a temporary folder and archive that one, or
you could create an archive with some of the files and add other files to the archive, if that is possible with your tool.

Nerakami wrote:
03 Mar 2020 09:52
I'm new to batch, i can only archive a folder but i can't make it loop to every subfolder, any ideas ?
Most compressors with a command line provide an option to recursively process files.


penpen