|
Contro
|
 |
« on: July 31, 2012, 02:17:09 PM » |
|
A software for compress file and able to find them first I try to explain. Excuse my language. I would to scan my hard disk (or disks) for a file with certain conditions. By example : locate the file "abc.txt" When find the file compress to a rar file. That all. But compress seperate each file found in his own folder. By example : y:\path1\abc.txt to y:\path1\abc.rar y:\path1\path2\abc.txt to y:\path1\path2\abc.rar That all I need Best Regards More complete more powerful. 
|
|
|
|
|
Logged
|
|
|
|
|
MilesAhead
|
 |
« Reply #1 on: July 31, 2012, 05:36:35 PM » |
|
Take a look at a port of Linux find command. Once you learn the syntax it's simple to have each result launch a command with the result itself as an argument. http://gnuwin32.sourceforge.net/packages.html
|
|
|
|
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
Contro
|
 |
« Reply #2 on: July 31, 2012, 06:34:55 PM » |
|
going Best Regards 
|
|
|
|
|
Logged
|
|
|
|
|
|
Contro
|
 |
« Reply #3 on: August 01, 2012, 06:16:25 AM » |
|
 Miles is a little difficult for me. It's a wonderful soft package for the dos console. Is there a soft more GUI or interactive for dummies ? Best Regards 
|
|
|
|
|
Logged
|
|
|
|
|
eleman
|
 |
« Reply #4 on: August 01, 2012, 06:18:49 AM » |
|
Copy the command line utility of winrar (rar.exe) into somewhere in the path (i.e. windows folder) Put this in a batch file (*.cmd or *.bat) and run this in the relevant folder. [ copy or print] for %%1 in (*.txt) do rar m -x*.rar -m5 "%%1.rar" "%%1" I know this does not scan the whole disk for subfolders, but only the current folder, but you can develop the batch file a bit. MilesAhead's proposed solution may be easier though.
|
|
|
|
|
Logged
|
|
|
|
|
daddydave
|
 |
« Reply #5 on: August 01, 2012, 06:27:05 AM » |
|
Just now I did this (I have Locate32 and HAOzip installed, I think any archiver would probably do) - Brought up Locate32 (I can bring it up using Win-F on my system)
- Did a search for .py (Python) files
- Selected a dozen files from the search results.
- Right clicked on the selected results
- Clicked HaoZip > Add to archive (Note: the Windows Explorer right click menu is replicated in Locate32)
- Clicked Browse and browsed to the Desktop
- Gave the filename Test.zip and hit OK.
- Opened the file Test.zip from the desktop and there were all the files I selected.
Is that something like what you need? (Re-reading the original post, I guess you are needing something more automated. It is a little more GUI, though.  )
|
|
|
|
« Last Edit: August 01, 2012, 06:34:08 AM by daddydave »
|
Logged
|
|
|
|
|
daddydave
|
 |
« Reply #6 on: August 01, 2012, 06:46:02 AM » |
|
Copy the command line utility of winrar (rar.exe) into somewhere in the path (i.e. windows folder) Put this in a batch file (*.cmd or *.bat) and run this in the relevant folder. [ copy or print] for %%1 in (*.txt) do rar m -x*.rar -m5 "%%1.rar" "%%1" I know this does not scan the whole disk for subfolders, but only the current folder, but you can develop the batch file a bit. MilesAhead's proposed solution may be easier though. I have a batch file that can run another batch file in the current directory and all subdirectories. Nothing special but I wanted to recreate something I had from the DOS days because I had a need at the time. I call it sweep.cmd Formatted for Text with the GeSHI Syntax Highlighter [ copy or print] @echo off setlocal set oldcd=%cd% for /R %%D in (.) do ( cd "%%D" %* ) cd /d %oldcd% endlocal
Maybe it would be of some use. Edit: corrected a bug I just now saw, lol
|
|
|
|
|
Logged
|
|
|
|
|
daddydave
|
 |
« Reply #7 on: August 01, 2012, 06:54:03 AM » |
|
I would to scan my hard disk (or disks) for a file with certain conditions
What tool do you currently use to search for files on your system, are you using the Windows default or a third party tool such as Locate32 or Everything. If Windows, what version of Windows? Are the "certain conditions" fairly constant or do you want to full search power of your chosen tool?
|
|
|
|
|
Logged
|
|
|
|
|
eleman
|
 |
« Reply #8 on: August 01, 2012, 07:07:21 AM » |
|
So, combining the line I provided with the work by daddydave: Put rar.exe into somewhere accessible such as the windows folder, and then use this as a batch file: [ copy or print] setlocal set oldcd=%cd% for /R %%D in (.) do ( cd "%%D" for %%1 in (*.txt) do rar m -x*.rar -m5 "%%1.rar" "%%1" ) cd /d %oldcd% endlocal Run it in the top folder where you want the compression to happen. Don't run it at your root folder or some system files which should remain txt will be compressed as well. That would be asking for trouble.
|
|
|
|
|
Logged
|
|
|
|
|
Contro
|
 |
« Reply #9 on: August 01, 2012, 07:09:40 AM » |
|
I would to scan my hard disk (or disks) for a file with certain conditions
What tool do you currently use to search for files on your system, are you using the Windows default or a third party tool such as Locate32 or Everything. If Windows, what version of Windows? Are the "certain conditions" fairly constant or do you want to full search power of your chosen tool? You read my little mind. I revived Locate32 last night. I have certain problems with locate and use less. My system is windows xp pro sp3
|
|
|
|
|
Logged
|
|
|
|
|
Contro
|
 |
« Reply #10 on: August 01, 2012, 07:11:29 AM » |
|
So, combining the line I provided with the work by daddydave: Put rar.exe into somewhere accessible such as the windows folder, and then use this as a batch file: [ copy or print] setlocal set oldcd=%cd% for /R %%D in (.) do ( cd "%%D" for %%1 in (*.txt) do rar m -x*.rar -m5 "%%1.rar" "%%1" ) cd /d %oldcd% endlocal Run it in the top folder where you want the compression to happen. Don't run it at your root folder or some system files which should remain txt will be compressed as well. That would be asking for trouble. Going to study. It seems that all txt file go compressed.
|
|
|
|
|
Logged
|
|
|
|
|
Contro
|
 |
« Reply #11 on: August 01, 2012, 07:15:10 AM » |
|
Just now I did this (I have Locate32 and HAOzip installed, I think any archiver would probably do) - Brought up Locate32 (I can bring it up using Win-F on my system)
- Did a search for .py (Python) files
- Selected a dozen files from the search results.
- Right clicked on the selected results
- Clicked HaoZip > Add to archive (Note: the Windows Explorer right click menu is replicated in Locate32)
- Clicked Browse and browsed to the Desktop
- Gave the filename Test.zip and hit OK.
- Opened the file Test.zip from the desktop and there were all the files I selected.
Is that something like what you need? (Re-reading the original post, I guess you are needing something more automated. It is a little more GUI, though.  ) Not very automated. And the zip is only one. I would like any file individually packed to the corresponding zip or rar. 
|
|
|
|
|
Logged
|
|
|
|
|
Contro
|
 |
« Reply #12 on: August 01, 2012, 07:17:15 AM » |
|
ull search power of your chosen tool
better full search power of your chosen tool of course, but any limited solution is good too because i need to do this task now and manually is very boring. 
|
|
|
|
|
Logged
|
|
|
|
|
skwire
|
 |
« Reply #13 on: August 01, 2012, 10:07:55 AM » |
|
Do you already have a text listing of the files you want compressed? As in, something like this:
c:\path\abc.txt c:\another\path\def.txt c:\more\stuff\ghi.txt
|
|
|
|
|
Logged
|
|
|
|
|
Contro
|
 |
« Reply #14 on: August 01, 2012, 12:02:51 PM » |
|
Do you already have a text listing of the files you want compressed? As in, something like this:
c:\path\abc.txt c:\another\path\def.txt c:\more\stuff\ghi.txt
Skwire sounds me as something I must have. But...  How can I obtain the txt file listing ?
|
|
|
|
|
Logged
|
|
|
|
|
MilesAhead
|
 |
« Reply #15 on: August 01, 2012, 03:28:59 PM » |
|
I don't use WinRar so the command line may have to be fixed. I just gleaned it from eleman's post. Script should be self-explanatory. You should enter the path as well as filename or the script will start searching in the working directory. For example, to search all folders on C: for readme.txt use C:\readme.txt as the command line arg. edit: if no file specified on command line, Input Box asks for the file name. As noted above, the path in the file name with be the start of the folder search. Otherwise it will start in the folder where the script is. Not tested as I don't have rar.exe installed [ copy or print] ; run with filename on command line ; whatever the starting directory of the filename, it will recursively dig into all folders beneath ; if 0 < 1 { InputBox,FilePat,,Enter File Name (e.g. C:\readme.txt) if (ErrorLevel) ExitApp } else FilePat = %1% Loop, %FilePat%,,1 { tmp := _FilePathNoExt(A_LoopFileLongPath) . ".rar" RunWait,rar m -x*.rar -m5 %tmp% %A_LoopFileLongPath% } ; --------- path manipulation functions - file doos not need to exist, but passing path="" tends to mess them up ---- _FilePathNoExt(path) { return _FileDirWithSlash(path) . _FileBaseName(path) } _FileExt(path) { SplitPath,path,,,ext return ext } _FileBaseName(path) { SplitPath,path,,,,basename return basename } _FileName(path) { SplitPath,path,filename return filename } _FileDir(path) { SplitPath,path,,fdir return fdir } _FileDirWithSlash(path) { return _FileDir(path) . "\" }
|
|
|
|
« Last Edit: August 01, 2012, 09:46:33 PM by MilesAhead »
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
Contro
|
 |
« Reply #16 on: August 01, 2012, 07:59:49 PM » |
|
 I'll try. It seems very similar to the other one give me the error windows. Going to study 
|
|
|
|
|
Logged
|
|
|
|
|
MilesAhead
|
 |
« Reply #17 on: August 01, 2012, 08:02:57 PM » |
|
 I'll try. It seems very similar to the other one give me the error windows. Going to study  I know the recursion works properly since I took it from a program I wrote to copy all files matching pattern in a folder tree to a single destination folder. If you get an error it's probably the WinRar command line. You may have to fix the switches. edit: code in previous post added InputBox if no command line filename given. So just double click if you prefer.
|
|
|
|
« Last Edit: August 01, 2012, 08:57:41 PM by MilesAhead »
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|