Computing.Net > Forums > Programming > transfer of files to anothe folder

transfer of files to anothe folder

Reply to Message Icon

Original Message
Name: graphica
Date: February 20, 2006 at 14:51:22 Pacific
Subject: transfer of files to anothe folder
OS: winxp
CPU/Ram: P4
Model/Manufacturer: Intel
Comment:

I was wondering if anyone might know how to transfer image files from "A" folder to "B" folder automatically whenever files are placed into "A" folder.

Thanks for any help on this



Report Offensive Message For Removal


Response Number 1
Name: CWoodward
Date: February 20, 2006 at 19:57:39 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Any prefered language?

"If it jams, force it. If it breaks, it needed replacing anyway."
-Murphy's Laws


Report Offensive Follow Up For Removal

Response Number 2
Name: graphica
Date: February 21, 2006 at 07:21:13 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Could this be done using dos batch files ?
I am running Xp pro so I am not sure what language would be better



Report Offensive Follow Up For Removal

Response Number 3
Name: Mechanix2Go
Date: February 21, 2006 at 09:51:17 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

You can do it witha batch file like this:

:: mover.bat
:loop
move A\*.img B
ping 1.1.1.1 -n 1 -w 120000
goto :loop
:: DONE


If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Response Number 4
Name: graphica
Date: February 21, 2006 at 11:50:19 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Thanks M2, this works great, is there a way to transfer folders also and also run with the dos window minimized

thanks again


Report Offensive Follow Up For Removal

Response Number 5
Name: IVO
Date: February 21, 2006 at 12:17:34 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

To run minimized add the following lines at the beginning of your script

@Echo Off
If %1.==. Start "%0" /Min %0 @ & GoTo :EOF

:LOOP
Move A\*.img B
Ping 1.1.1.1 -n 1 -w 120000
GoTo :LOOP
:: DONE

To move folders is actually to rename them. Use the same command Move to achieve that, i.e.

Move Folder1 Folder2


Report Offensive Follow Up For Removal


Response Number 6
Name: graphica
Date: February 21, 2006 at 15:07:56 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Ivo, when i run the script you suggested it gives me the error "Windows cannot find 'and'make sure you typed the name correctly,and try again. To search for a file,clickthe Start button, and then click Search"

@Echo Off
If %1.==. Start "%0" /Min %0 @ &
GoTo :EOF
:LOOP
Move A\*.img B
Ping 1.1.1.1 -n 1 -w 120000
GoTo :LOOP
:: DONE


thanks for your input


Report Offensive Follow Up For Removal

Response Number 7
Name: Mechanix2Go
Date: February 21, 2006 at 21:46:29 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Hi IVO,

What does the @ in your line 2 do?


If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Response Number 8
Name: IVO
Date: February 22, 2006 at 02:13:25 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Hi M2 and graphica,

When I post a script I have allways tested it before and this case follows the rule. The script works fine under my Win XP SP2, any way for sake of safety use the following slightly modified code

@Echo Off
If %1.==. Start "%0" /Min %0 RUN
If %1.==. GoTo :EOF
:LOOP
Move A\*.img B
Ping 1.1.1.1 -n 1 -w 120000
GoTo :LOOP

I suppose the problem is due to the If line the seems to span to rows ending with & while & GoTo :EOF should be the correct end.

The @ character, now replaced by the word RUN, is just to set up the %1 parameter that at first start must be left blank so triggering the Start command to minimize the window.

On the fly, M2, did you get my mail?
:: DONE


Report Offensive Follow Up For Removal

Response Number 9
Name: Mechanix2Go
Date: February 22, 2006 at 03:47:00 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Hii IVO,

No, But I found choice.exe and downloaded it.

Thanks again.

When I get around to it, I'll test both CHOICEs and see what errors, if any.


If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Response Number 10
Name: graphica
Date: February 22, 2006 at 13:02:46 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

m2 and Ivo thanks again ,it works perfectly, I have one more question regarding the move command in the batch file, is there a way to move a folder within the "IN" folder to the "out" folder, files move o.k but folders remain in the "IN" folder.The problem is I have no way of knowing what the name of this folder is as the names of the folders will never be the same.

thanks again for your assistance


Report Offensive Follow Up For Removal

Response Number 11
Name: IVO
Date: February 22, 2006 at 14:01:09 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Well graphica, as I posted, you can move the folders from the source to the target by the Move command with the limit either source and target must belong to the same logical drive. You need a compound For statement, i.e.

@Echo Off
If %1.==. Start "%0" /Min %0 RUN
If %1.==. GoTo :EOF
:LOOP
Move A\*.img B
For /F "tokens=* delims=" %%A in ('Dir A /AD /B') Do Move A\%%A B
Ping 1.1.1.1 -n 1 -w 120000
GoTo :LOOP

where the For statement fits just ONE line without CR/LF starting with For and ending with B.

A and B must belong to the same drive.
This should achieve your target. If you experience any trouble, report to me as I do not tested it very accurately.


Report Offensive Follow Up For Removal

Response Number 12
Name: graphica
Date: February 22, 2006 at 17:25:30 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

IVO, bear with me but I need some clarification
I have called the directory I will be receiving files/folders "IN" and the one the files/folders will be sent to as "OUT"

So so far I have

@Echo Off
If %1.==. Start "%0" /Min %0 RUN
If %1.==. GoTo :EOF
:LOOP
Move C:\In\*.* C:\Out
For /F "tokens=* delims=" %%A in ('Dir A /AD /B') Do Move A\%%A B
Ping 1.1.1.1 -n 1 -w 120000
GoTo :LOOP

The fifth line needs some touching up, and I'm afraid I'm not up to the task

thanks


Report Offensive Follow Up For Removal

Response Number 13
Name: IVO
Date: February 23, 2006 at 02:11:20 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Just replace the For /F line with the following

For /F "tokens=* delims=" %%A in ('Dir C:\In /AD /B') Do Move C:\In\%%A Out

where the For /F line starts with For /F and ends with Move C:\In\%%A Out witouth CR/LF as previously posted. As your source and target drive is the same (C:), no problem should arise.


Report Offensive Follow Up For Removal

Response Number 14
Name: graphica
Date: February 23, 2006 at 09:22:41 Pacific
Subject: transfer of files to anothe folder
Reply: (edit)

Ivo -this works like a charm, thanks again for allyour help!!!


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: transfer of files to anothe folder 

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge