Jump to content

Script to move flat file structure into sub-folders w/ proper naming


mastrmind11

Recommended Posts

mastrmind11

So, I apologize.  I can do this myself given a few hours, of which I have approximately 0.  If anyone has a bash script out there that takes a flat folder and is able to create subs w/ the proper media name (year) convention and move every associated file into that folder, you'd be my hero.  Been flat for so long, time to clean this stuff up.  If not, no worries, I'll get to it eventually.  Thanks

 

eg:  movie1.blah.blah.year.mkv

movie1.blah.blah.nfo

movie1.jpg

...

etc

Edited by mastrmind11
Link to comment
Share on other sites

kanipek

Something like this? Found @: https://stackoverflow.com/questions/28921039/batch-create-a-folder-based-on-filename-and-move-multiple-related-files-to-the?rq=1#

 

There are a few examples there. Also there is old reliable File2Folder: http://code.google.com/p/file2foldergui/downloads/list

File2Folder has a GUI available and you can also use it via CLI  in a batch or powershell script

 

Also this: http://www.thewindowsclub.com/automatically-move-files-to-folders-windows

@[member="Echo"] off
setlocal

set "basename=."
for /F "tokens=1* delims=." %%a in ('dir /B /A-D ^| sort /R') do (
   set "filename=%%a"
   setlocal EnableDelayedExpansion
   for /F "delims=" %%c in ("!basename!") do if "!filename:%%c=!" equ "!filename!" (
      set "basename=!filename!"
      md "!basename!"
   )
   move "!filename!.%%b" "!basename!"
   for /F "delims=" %%c in ("!basename!") do (
      endlocal
      set "basename=%%c
   )
)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...