need help for .bat file

Discussion in 'Off-Topic' started by ep.hobbyiest, Sep 12, 2015.

  1. ep.hobbyiest

    Thread Starter Member

    Aug 26, 2014
    91
    0
    Hi
    i have 10 files which is need to put into 7 folders. many times i have to do same thing that copy 10 files from folder and save it 7 sub folder. So i need batch file this.

    In my one folder batch file and 10 other files and 7 folder's are there. so i want to run that batch file and move that 10 files into that 7 folder. So i tried to give path by %cd% and also different thing
     
  2. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,058
    3,820
    The DOS file command (for BAT files, is: MOV fileName destinationFileLocation)

    The fileName must contain absolute file path or logical file path. Same with DestinationFileLocation.
     
  3. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,550
    2,374
    Are the DIR's already made or do you have to make them first (MKDIR Path..)?
    Max.
     
  4. flat5

    Active Member

    Nov 13, 2008
    403
    17
    Can you make it simple and have the 7 folders as direct sub folders of the folder containing the 10 files? Can they be named 1 through 7?
    Can the files be named 1 through 10?

    A nested 'for' loop will do what you want.
    I'd use 'copy' and delete the master file after checking the 7 folders but a delete line could be added to the batch file at the end.
     
  5. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,347
    cmartinez likes this.
  6. ep.hobbyiest

    Thread Starter Member

    Aug 26, 2014
    91
    0
    Direcotries will be there only, we don't have to create directories. and name also are different.
    i treied move command and copy command. i am able to copy it if i give full path like "D:\batch\doc" but i don't want to use path because i may be run this file from different places.

    my directory is batch(path is not fixed that is it will be may be C drive D drive). so inside batch folder there sub folder's and and files.
    I want to move that files into that subfolders.

    I have attached sample dir structure.
     
  7. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,347
    Hello,

    You can use ./ in the path for the current path.
    For example ./doc is the doc directory in the current path.
    You can use ../for the parent directory (one directory back in the tree).

    Bertus
     
Loading...