Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to move multiple files of 1 folder to multiple folders?
#1
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:

Code:
Copy      Help
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:
Code:
Copy      Help
ren "$Desktop$\T\ {k}.txt to {k+4}.txt" "Desktop$\{i}"

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


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)