The MP3car.com Store The MP3car.com Store    

Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-16-2007, 10:27 AM   #1
FLAC
 
Sal R.'s Avatar
 
Join Date: Aug 2006
Location: Sun Diego
Posts: 983
Need help w/ AutoIT copy file/folder script...

$origin and $destination are defined in Road Runner and passed to the script.

This piece of code works except for the fact if $origin folder has sub-directories, it won't get copied over to the path defined by $destination.

Code:
$origin = $rr.getinfo("=$origin$") $destination = $rr.getinfo("=$destination$") ;Get origin info - file or folder $originarray = StringSplit($origin, "\", 1) $originarraycount = $originarray[0] $fileorfolder = StringInStr($originarray[$originarraycount], ".") ;Search string for "." to denote a file. Otherwise, a folder If $fileorfolder == 0 Then ;Commands to execute if origin is a folder FileCopy($origin & "\*.*", $destination & $originarray[$originarraycount] & "\", 9) If FileExists($destination & $originarray[$originarraycount] & "\*.*") Then $rr.execute("MENU;SUCCESS.skin||SETLABEL;!STATUS;Folder Copied") ;Confirmation skin Else $rr.execute("MENU;FAIL.skin||SETLABEL;!STATUS;Copy Failed!") ;Confirmation skin EndIf Else ;Commands to execute if origin is a file ;MsgBox(4096,"Drive ", "It's a file") FileCopy($origin, $destination, 1) If FileExists($destination & $originarray[$originarraycount]) Then $rr.execute("MENU;SUCCESS.skin||SETLABEL;!STATUS;File Copied") ;Confirmation skin Else $rr.execute("MENU;FAIL.skin||SETLABEL;!STATUS;ERROR! Copy Failed!") ;Confirmation skin EndIf EndIf

I've been searching the autoIT help for a few hours now and can't find a solution that will work. The DirMove works, but it deletes the $origin folder.

Any help would be greatly appreciated.
__________________
nLite'd XP Pro / RR v09/10/2008 / Winamp v5.13
Sal R. is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 11-19-2007, 06:33 AM   #2
Low Bitrate
 
MOnline's Avatar
 
Join Date: Apr 2007
Location: Holland, Poeldijk (Near The Hague)
Posts: 77
Hi,

When you copy only one file does this work.

Because I can image that when you move an entire folder windows "recreates" it just like overwriting a file. If file copy works have you tried copying all the files in the folder instead of copying the folder itself ?

With kind regards,

FG van Zeelst
__________________
Check out My Custom Frontend
MOnline is offline   Reply With Quote
Old 11-19-2007, 08:00 AM   #3
MySQL Error
 
Sonicxtacy02's Avatar
 
Join Date: Sep 2004
Location: Woodbridge, VA
Posts: 4,998
create a backup directory in the origin's location.. use dir move then after you've confirmed the move is complete just rename the backup to origins name. K.I.S.S Method ! lol
__________________
03 Acura RSX Coupe
a K.I.S.S Flash, VB, and Autoit Programmer
HARDWARE PROGRESS: 90%[/////////-]
Developer of: RRFusion, MovieTimes, (new)RRMail
Coming Soon:RRChrome, RR Plugin Browser & CentraFusion
Sonicxtacy02 is offline   Reply With Quote
Old 11-19-2007, 09:17 AM   #4
FLAC
 
Sal R.'s Avatar
 
Join Date: Aug 2006
Location: Sun Diego
Posts: 983
Quote: Originally Posted by MOnline View Post
Hi,

When you copy only one file does this work.

Because I can image that when you move an entire folder windows "recreates" it just like overwriting a file. If file copy works have you tried copying all the files in the folder instead of copying the folder itself ?

With kind regards,

FG van Zeelst

It copies all the files in the $origin directory.

If there are subdirectories w/ files in the $origin, it won't get copied over, which is what I'm trying to do with just one copy command instead of multiple commands.

Quote: Originally Posted by Sonicxtacy02 View Post
create a backup directory in the origin's location.. use dir move then after you've confirmed the move is complete just rename the backup to origins name. K.I.S.S Method ! lol

So how do I create a backup using autoIT? I'd still have to make a backup copy of $origin before being able to use DirMove to $destination, right?
__________________
nLite'd XP Pro / RR v09/10/2008 / Winamp v5.13
Sal R. is offline   Reply With Quote
Old 11-21-2007, 02:22 PM   #5
FLAC
 
Sal R.'s Avatar
 
Join Date: Aug 2006
Location: Sun Diego
Posts: 983
Problem solved.

Found the DirCopy command...by accident when I mistakenly typed in xcopy.

Lucky me.

=)
__________________
nLite'd XP Pro / RR v09/10/2008 / Winamp v5.13
Sal R. is offline   Reply With Quote
Old 11-22-2007, 05:46 AM   #6
Low Bitrate
 
MOnline's Avatar
 
Join Date: Apr 2007
Location: Holland, Poeldijk (Near The Hague)
Posts: 77
Glad to hear it you solved the problem

With kind regards,

FG van Zeelst
__________________
Check out My Custom Frontend
MOnline is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone make an autoit script for me? Kamakazie2 Software & Software Development 2 12-23-2006 06:37 PM
Any AutoIt script experts out there? mindracing Centrafuse 8 08-11-2005 02:19 PM


All times are GMT -5. The time now is 04:53 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics