Overclockers Australia Forums
OCAU News - Wiki - QuickLinks - Pix - Sponsors  

Go Back   Overclockers Australia Forums > Software Topics > Programming & Software Development

Notices


Sign up for a free OCAU account and this ad will go away!
Search our forums with Google:
Reply
 
Thread Tools
Old 15th February 2010, 7:50 PM   #1
StratosFear Thread Starter
Member
 
Join Date: Jun 2001
Location: Melbourne, Australia
Posts: 7,685
Default Simplish Bat file issue.

I'm trying to write a very simple bat file that can be executed to automatically go through every *.avi on a CD/DVD that is inserted and copy them to my harddrive on my Media PC.

It basically, scans the DVD, creates a directory for each AVI on the disc and then copies it to the harddrive, if it doesn't already exist.

This works great for filenames without spaces. But if it has a space it only takes the filename up to the first space and then obviously doesn't copy correctly.

I can't find much info on how to get this to work....

It's basically 2 bat files.

The first one

Code:
for /f %%a IN ('dir /b/s e: *.avi') do C:\copyfile %%~da %%~sa %%~xa
Lists all the *.avi files with directory structure, then parses the drive, filename and extension to 'copyfile' bat which is below:

Code:
d:
cd "SD Movies"
IF EXIST %2 GOTO END
MD %2
ECHO COPYING %2 TO D:\SD MOVIES
COPY %1\%2%3 .\%2\
:END
ECHO %2 ALREADY EXISTS

So as I said if the filename has no spaces it works fine, but if it has spaces the %%~sa variable only pulls the first portion of the name...

Any ideas?
StratosFear is offline   Reply With Quote

Join OCAU to remove this ad!
Reply

Bookmarks

Sign up for a free OCAU account and this ad will go away!

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time now is 5:43 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. -
OCAU is not responsible for the content of individual messages posted by others.
Other content copyright Overclockers Australia.
OCAU is hosted by Internode!