11-28-2012, 08:58 AM
Introduction: Hi, I have multiple files in one folder T and want to move part by part of them into multiple folders i.
Example: Say, folder T has 15 .txt files and I want to move from file 1-5 into folder 1, then 6-10 into folder 2 and 11-15 into folder 3.
What I have done so far? I wrote the following lines which was supposed to generate i-number of folders and move the k-files:
Problems:
1) The folders are not being created, instead of that it creates only one folder {i}.
2) Even if the folder i exist, I obtain an error that it cannot move the file.
3) Now, let's assume the syntax problems are fixed and the code is doing it right, this means it would move file by file in each run of i. Question, is there a way to select directly the range of files to move to avoid doing it file by file? Something like:
So I wonder if someone could help me to correct these lines or suggest a new way to do the same.
I thank you in advance for your help
Emerson
Example: Say, folder T has 15 .txt files and I want to move from file 1-5 into folder 1, then 6-10 into folder 2 and 11-15 into folder 3.
What I have done so far? I wrote the following lines which was supposed to generate i-number of folders and move the k-files:
int nfi=5 ;;number of files per folder
int nfo=3 ;;number of folders
int i j=nfo+1
for(i 1 j)
out i
mkdir "$Desktop$\{i}" ;; Make i-ten folder
int k l=(i*nfi)+1
for(k ((i*nfi)-(nfi-1)) l)
out k
ren "$Desktop$\T\{k}.txt" "$Desktop$\{i}" ;; Move k-ten file from folder T to folder i
Problems:
1) The folders are not being created, instead of that it creates only one folder {i}.
2) Even if the folder i exist, I obtain an error that it cannot move the file.
3) Now, let's assume the syntax problems are fixed and the code is doing it right, this means it would move file by file in each run of i. Question, is there a way to select directly the range of files to move to avoid doing it file by file? Something like:
So I wonder if someone could help me to correct these lines or suggest a new way to do the same.
I thank you in advance for your help
Emerson