Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have the following issue:
I had a routine to rename approx. 40.000 files on my hard-drive - I had copied them from a server_location earlier on.
I had that routine ready and I had tested it on 10 files and it worked fine.
Now I see that apparently it has not worked and I have no idea why.
The idea was like this:
- The files were made up of a 7-digit number, a '.' and a >01< or >02<, the ending was jpg or JPG in all cases
=> >xxxxxxx.01.jpg< for instance
- I took that apart into that 7-digit number and the rest
- For every one of those 7-digit numbers, I found a matching 2-digit number
=> So I used some simple QlikView logic to make up the new name:
7-digit-number - 2-digit-number - the rest
(ex.: xxxxxxxyy.01.jpg)
(like I said, I tested that routine on 10 files and it worked fine, the cmd-line command >rename< did just what it's supposed to do, it changed the filename.
I let that run over all 40.000 files with a command-line command >rename< - it finished on Friday after I went home.
<=> Now I look into the directory where all the files are stored and I see that apparently the files have not been renamed.
I will attach my code so you can have a look at it. Maybe one of you has an idea what the issue could be - I have none.
Thanks a lot!
Best regards,
DataNibbler
P.S.: Since time is somewhat critical on this by now, I will continue testing while waiting for an answer and I will post again as soon as I know something new.
P.P.S.: I just realize there was one line (the DIRECTORY command) with a wrong directory - the one where I had done the testing, where none of those 40.000 files could be found - but I used the full name_incl_path for the cmd-line command - can that still have been the issue?
Here is my code:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Gesamtliste:
LOAD
rowNo() as Line_ID,
SN_key, // This is the 7-digit number
Namensendung, // This is the remainder of the name, for instance >01<
(SN_key & '.' & Namensendung & '.jpg') as Dateiname_incl_Endung,
(SN_key & AI & '.' & Namensendung & '.jpg) as Dateiname_2b_incl_Endung,
AI,
Dateiname_incl_Pfad // This is the complete filename_incl_path (the path and name don't have any BLANKs)
FROM
[Excel_file]
;
Let v_rows = NoOfRows('Gesamtliste');
DIRECTORY (wrong directory given);
FOR i = 0 TO ($(v_rows) - 1)
LET v_file_old = PEEK('Dateiname_incl_Endung', $(i), Gesamtliste);
LET v_file_new = PEEK('Dateiname_2b_incl_Endung', $(i), Gesamtliste);
EXECUTE cmd.exe /C rename $(v_filename_old) $(v_filename_new);
NEXT i
Okay,
finally the chapter is closed. All the files are properly renamed now.
I will thus close the thread.
Best regards,
DataNibbler
Hi,
to my I-cannot-say-how-great relief, it seems that the issue really was the fawlty DIRECTORY command.
I corrected that to point to the directory where the files really are and tested one or two in there and it worked fine. Then, as a colleague told me it is safe, I let it run at full speed - it will still run on for another two hours or so, but we have already seen that the renaming is now being done all right.
It seems this is solved then. I will not close the thread just now, however. I will close it once I'm positively sure that the chapter can be closed.
Best regards,
DataNibbler
Okay,
finally the chapter is closed. All the files are properly renamed now.
I will thus close the thread.
Best regards,
DataNibbler