Results 1 to 2 of 2
  1. #1

    Default Batch File Move folders using robocopy


    Good day,

    guys need your help,
    need anyone who has idea on my scenario
    currently need a batch file to move folders using robocopy
    scenario:

    i need to move a folder including all subfolders inside it
    sample:

    C:\sourcefolder\upload\102910\folder1
    C:\sourcefolder\upload\102910\folder2
    C:\sourcefolder\upload\102910\folder3
    to
    D:\destinationfolder\processed\102910\folder1 etc.

    the catch here, the folder 102910 is not a constant name, everyday it will change today date.
    so we can't put a constant address i have to used a wildcard, i already solve this problem.

    my problem facing now, when during moving, i can't move the folders only the files are being move.
    so sample:

    c:\sourcefolder\upload\102910\folder1
    C:\sourcefolder\upload\102910\folder2
    C:\sourcefolder\upload\102910\folder3
    C:\sourcefolder\upload\102910\sample.txt
    C:\sourcefolder\upload\102910\helo.doc

    only the sample.txt and helo.doc are being move. the folders are not being move.
    you may suggest using dos move function the problem about the dos move function,
    inside the upload folder there are other folders that i don't need to move.

    as below code you may see i used a IF EXIST where it will look each folder if there is a .txt file, if it has no .txt file it will not move...only those folders that has .txt file are being move.

    here is my syntax:


    echo off

    SET DRIVELETTER=c:\sourcefolder\upload
    SET DESTINATION_PROCESSED=d:\destinationfolder\process ed\%%~nxz

    FOR /D %%z IN ( "%DRIVELETTER%\*.*" ) DO (
    ECHO path:%%~z
    ECHO name:%%~nz


    rem MOVE FILES AND FOLDERS TO NEW LOCATION
    IF EXIST %%~fz\*.TXT ROBOCOPY "%%z" "%DESTINATION_PROCESSED%" "*.*" /XD D:\test\upload\otherfolder /MOVE /R:10 /W:30 /Z )

    )

    hopefully someone can help me on this.

    Thank you.
    Last edited by bolivar1985; 10-29-2010 at 03:19 PM.

  2. #2
    have just solve the problem what a dumb am i...hehehe...
    just added /E to the last line of robocopy

  3.    Advertisement

Similar Threads

 
  1. simple PING program using batch file
    By anggwaponi in forum Programming
    Replies: 12
    Last Post: 08-20-2009, 04:29 AM
  2. opening an eps file in photoshop using php..
    By ichiriki in forum Programming
    Replies: 1
    Last Post: 10-28-2008, 06:43 PM
  3. BATCH file for manual removal of viruses
    By tapsikret in forum Programming
    Replies: 2
    Last Post: 03-05-2008, 08:52 AM
  4. Deleting deep freeze file in BIOS' using boot disk
    By l3inad in forum Software & Games (Old)
    Replies: 1
    Last Post: 01-05-2007, 02:14 PM
  5. Replies: 32
    Last Post: 08-12-2006, 07:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top