AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

wildcard filemove bug

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Trubbleguy



Joined: 20 Jan 2007
Posts: 76
Location: Melbourne

PostPosted: Sun Jun 22, 2008 2:33 am    Post subject: wildcard filemove bug Reply with quote

i wrote a small prog to split a mixed folder of 1000's of files into their own folder if it got a match from a db.
all the files had a unique diskid in the name of the file eg:
sf123-01-the way we were - artistname.zip
sf123-02-the way we were not - nameofartist.zip
sf123-03-the way we went - artistiswho.zip

sf123 is in a database that it checks the files against, if it gets a hit (sf123) it uses wildcard move to move all the files containing sf123 in the name to a folder called sf123
Code:
filemove, %sourcepath%\%var that equals sf123%-*.zip, %destpath%\%var that equals sf123%\

i even put the - in the wildcard to make sure its exact in getting a match.
The issue is that it is also copying a single file not matching the %var that equals sf123% in any form to the destination folder occasionally.
it will sort the folder with 10,000 zips very fast with 98% perfection
But some folders it has sorted files to, has an extra file not matching any
of the filemove criteria!!!!
so in the folder sf123 is a file called:
sf456-14-songname-artistname.zip
which shouldn't be there. (the only possible match is the zip extension *.zip)
i moved all the zips back to one folder and ran it again, the results were different every time, where sf123 folder was correct or after doing it again, a different folder that was correct is no longer correct?

any ideas?
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Sun Jun 22, 2008 3:53 am    Post subject: Reply with quote

I moved your topic to ask for help for now. If you make your code like this:
Code:

loop, %sourcepath%\%var that equals sf123%-*.zip,
{
  filemove, %A_LoopFileFullPath%, %destpath%\%var that equals sf123%\
  if errorlevel
    msgbox Error: %errorlevel%
}


you can maybe see why it's skipping some

(untested)
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Trubbleguy



Joined: 20 Jan 2007
Posts: 76
Location: Melbourne

PostPosted: Sun Jun 22, 2008 4:52 am    Post subject: Reply with quote

does that mean there is not a bug with wildcard filemove then?
i did try it a few times before i posted..
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Mon Jun 23, 2008 3:58 am    Post subject: Reply with quote

i don't think it's a bug. I expect some of the moves failed for some reason, so they were skipped. the code just wasn't checking for errors. did my code work?
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Trubbleguy



Joined: 20 Jan 2007
Posts: 76
Location: Melbourne

PostPosted: Mon Jun 23, 2008 4:55 am    Post subject: Reply with quote

all moves were successful, but an extra file with absolutely no connection with the other files also moved. none were missed
your move works better as it uses the whole filename and path after matching in a outer loop first. i am using it now as it doesn't make mistakes due to the check.
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Z Gecko
Guest





PostPosted: Mon Jun 23, 2008 5:07 am    Post subject: Reply with quote

I am really buffled,
from all what i know your code should have never worked
because of the var-name you choose.
Quote:
Variable names: Variable names are not case sensitive (for example, CurrentDate is the same as currentdate). Variable names may be up to 254 characters long and may consist of letters, numbers and the following punctuation: # _ @ $ ? [ ]
So i was expecting to use a var like "var that equals sf123" would not work at all.
So am i missing something?
If not,
try renaming your var to something without spaces (e.g. "var_that_equals_sf123")!
Back to top
Trubbleguy



Joined: 20 Jan 2007
Posts: 76
Location: Melbourne

PostPosted: Mon Jun 23, 2008 11:30 am    Post subject: Reply with quote

the %var that equals sf123% was simply a pseudonym for the actual var i used. I did it that way to get my message across.
sorry for the confusion.
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group