Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


Pskonejott

24 posts

Geek


#34131 19-May-2009 09:27
Send private message

I have about 600 DVD's on a NAS organised by Movie Name\<DVD files>. I would like to change this to Movie Name\VIDEO_TS\<DVD files>. Is anyone good with windows batch scripts able to help out? This will need to handle files and folders with spaces in the name.

I had a go and was able to get as far as creating the VIDEO_TS folders but I couldn't figure out how to do the file move into the new VIDEO_TS subfolders.

Create new topic
quandum
204 posts

Master Geek
+1 received by user: 5


  #215860 19-May-2009 11:38
Send private message

Are you able to post the script you're using so far please?




I would love to change the world, but they won't give me the source code

#BOFH



magu
Professional yak shaver
1599 posts

Uber Geek
+1 received by user: 7

Trusted
BitSignal
Lifetime subscriber

  #215870 19-May-2009 12:13
Send private message

A COPY command followed by an errorlevel check, then a DELETE should do it.

Or you could do some advanced programming using XCOPY (Microsoft-provided) or XXCOPY (freeware available on the net).

With XXCOPY, I've once done a 'copy files between 30 to 60 days old to a new folder' batch that also compressed the folder and removed the originals.




"Roads? Where we're going, we don't need roads." - Doc Emmet Brown

Pskonejott

24 posts

Geek


  #215873 19-May-2009 12:21
Send private message

quandum, unfortunately my laptop crashed during hibernation and I lost what I had but I'll take another look tonight if no one has any code I can use before then.

magu, copy is not feasible as it would involve transferring all 2.5TB of files back onto my laptop and then re-transferring them back to the NAS. Move would be much more elegant. However I need to do something like move z:\movie1\ to z:\movie1\VIDEO_TS\, but 600 times, or probably closer to 750 times if I do the TV shows too. I need something like a "for each" or a loop that will do this for me but I'm not familiar enough with batch scripts to write one.



quandum
204 posts

Master Geek
+1 received by user: 5


  #215875 19-May-2009 12:25
Send private message

try the script below. you will need to change the z:\movies path to suit your setup.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("z:\movies")
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders

ParentFolder = "z:\movies\"&objSubfolder.Name
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.NameSpace(ParentFolder)
objFolder.NewFolder "Video_TS"

If objSubfolder.Size>0 Then

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "z:\movies\"&objSubfolder.Name&"\*.*" , "z:\movies\"&objSubfolder.Name&"\Video_TS"

End If


Next




I would love to change the world, but they won't give me the source code

#BOFH

Pskonejott

24 posts

Geek


  #215884 19-May-2009 12:51
Send private message

Thanks a lot, I tried it with a few local movies and it worked great. I'll do a smaller test run on the NAS and then parse it over the whole lot tonight.

quandum
204 posts

Master Geek
+1 received by user: 5


  #215977 19-May-2009 16:07
Send private message

Enjoy.

PS: any chance of "borrowing" some DVD's mwahah




I would love to change the world, but they won't give me the source code

#BOFH

 
 
 

Move to New Zealand's best fibre broadband service (affiliate link). Free setup code: R587125ERQ6VE. Note that to use Quic Broadband you must be comfortable with configuring your own router.
ANglEAUT
altered-ego
2436 posts

Uber Geek
+1 received by user: 841

Trusted
Lifetime subscriber

#223622 10-Jun-2009 14:55
Send private message

Do do this yourself using batch files instead of VBScripting:
Batch File function library @ http://www.commandline.co.uk/lib/treeview/index.php or
The Windows Command line @ http://commandwindows.com/

Links set to open in new browser windows.

Batch file should something like this

@echo off
Z:
CD "dirname"
for %%k in (*.) do md "%%k\Video_TS"&&move "%%k\*.*" "%%k\Video_TS"

This is untested & only a suggested starting point
Use at your own peril





Please keep this GZ community vibrant by contributing in a constructive & respectful manner.


Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.