Archive a subfolder and delete it

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Nerakami
Posts: 1
Joined: 03 Mar 2020 09:42

Archive a subfolder and delete it

#1 Post by Nerakami » 03 Mar 2020 09:52

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 ?

penpen
Expert
Posts: 1786
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Archive a subfolder and delete it

#2 Post by penpen » 03 Mar 2020 14:52

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

Post Reply