Friday, 15 August 2014

Change file name and move files based on file path in Windows 7 -


I have a bunch of distributed image files in folders and sub-folders what I would like to do, move them all to the same folder And rename them based on their previous path.

For example, the file should be src / a / b / file1.png

should be src / a_b_file1.png

Perhaps a smart way to do this in Linux Is, but I am currently on a Windows 7 machine.

Any tips will be good, GUI or command line equipment or some scripts, no matter. Thanx.

Try it: and then check renfile.bat in Notepad whether it's right for you or not . If you need them add more file types.

  @echo off echo @Echo off & gt; For Renfile.bat call / f "delims =" %% a in ('dir * .jpg * .png * .gif / b / s / ad'): Next "%% a" echo Renfile.bat Built Pause Goto: Eof: Set the set "var =% ~ 1" next to "var = %% var:% cd% = %%" set "var =% var: \ = _%" & gt; & Gt; Rainfile.bat Echo Rain "% ~ 1" "% var: ~ 1%"   

and once the batch file is moved to move all the files:

  @echo off Md "c: \ target folder \" for / f "delims =" %% a in ('dir * .jpg * .png * .gif / b / s / ad') ("%% a" move: \ Target folder \ ")    

No comments:

Post a Comment