using .bat to search the folder and compres files into zip.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
KillerBueno
Posts: 2
Joined: 23 Dec 2008 03:54

using .bat to search the folder and compres files into zip.

#1 Post by KillerBueno » 13 Jan 2009 07:32

hi there!
I'm just wondering is it possible, that a simple MS-DOS Batch file could find files and compres them into zip? I have a network drive, and the pictures are in one place, separated in subfolders named for example 2006, 2007... could you help or give me some useful tips? :)

Thanks,
Adrian N.

Cander
Posts: 7
Joined: 01 Jan 2009 15:35

#2 Post by Cander » 13 Jan 2009 15:59

Yes, this should be possible to do with a pretty simple batch file. Not an expert on this parts, but I know that you can zip and unzip from cmd, so there shouldn't be problems doing this.

KillerBueno
Posts: 2
Joined: 23 Dec 2008 03:54

#3 Post by KillerBueno » 23 Jan 2009 12:33

maybie you could post how to do a batch file like this, please?

songkok
Posts: 3
Joined: 03 Feb 2009 14:04
Location: Germany

#4 Post by songkok » 03 Feb 2009 14:17

i will post the batch file tomorrow. just one question, what kind of zip you use? 7zip or winzip?

venom
Posts: 4
Joined: 17 Jan 2009 03:14

#5 Post by venom » 05 Feb 2009 11:08

here are a couple methods i use

winrar
START /belownormal /wait /min /D"C:\Program Files\WinRAR" winrar a -ep -afzip "C:\path\to\output_file.zip" "C:\path\to\the\directory\you\want\to\zip"

7-zip
START /belownormal /wait /D"C:\Program Files\7-Zip\" 7z.exe a -tzip -r -mx5 "C:\path\to\output_file.zip" "C:\path\to\the\directory\you\want\to\zip"

spam_killer
Posts: 12
Joined: 10 Oct 2008 04:50

Known

#6 Post by spam_killer » 11 Feb 2009 07:18

If you want to know all related command, just open Winrar then goto help and find there..

Thanks

santhosh
Posts: 41
Joined: 02 Aug 2010 05:10

Re: using .bat to search the folder and compres files into z

#7 Post by santhosh » 07 Aug 2010 09:32

thanks

its zipping a file .........but can i zip a folder........using this same command

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: using .bat to search the folder and compres files into z

#8 Post by !k » 07 Aug 2010 23:05

santhosh, both this commands zip a folder

Note:
START /belownormal /wait /min /D"C:\Program Files\WinRAR" winrar a -ep1 -afzip "C:\path\to\output_file.zip" "C:\path\to\the\directory\you\want\to\zip"

santhosh
Posts: 41
Joined: 02 Aug 2010 05:10

Re: using .bat to search the folder and compres files into z

#9 Post by santhosh » 08 Aug 2010 11:17

!k thnks,

but again i am facing same problem, its zipping only files inside that folder...not the folder.

example:
i have a folder name sat,inside this i got sub folders and files.
now i want to zip this sat folder.


when i tried its zipping all the files but not the folder.


kindly help me out what changes should i do.

santhosh
Posts: 41
Joined: 02 Aug 2010 05:10

Re: using .bat to search the folder and compres files into z

#10 Post by santhosh » 08 Aug 2010 11:21

one more example....if that sat folder doesn't have any file, when i run the script it shows error " no files is add to zip".
but it should zip that folder right...how to do it.

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: using .bat to search the folder and compres files into z

#11 Post by !k » 08 Aug 2010 11:46

START /belownormal /wait /D"C:\Program Files\7-Zip\" 7z.exe a -tzip -r- -mx5 "C:\path\to\output_file.zip" "C:\path\to\the\directory\you\want\to\zip\*.*"
santhosh, read the help on the command line of archiver

santhosh
Posts: 41
Joined: 02 Aug 2010 05:10

Re: using .bat to search the folder and compres files into z

#12 Post by santhosh » 09 Aug 2010 15:24

Thanks !k

i found it

START /belownormal /wait /min /D"C:\Program Files\WinRAR" winrar a -rr -r -ep1 -afzip "C:\Documents and Settings\Pretups2

\dat.rar" "C:\Documents and Settings\Pretups2\sat"

Post Reply