Skip to main content
deleted 7 characters in body
Source Link

I have 1 x big folder that has lots of .txt files

I am trying to group these .txt files in separate subfolders based on a specific rolesrules from a rules.csv file (on what subfolder they belong to):

LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt

The rules would be:

file1.txt
file3.txt
file8.txt

belong to "subfolder1"

file2.txt
file4.txt
file23.txt

belong to "subfolder2"

etc

Here's the list of rules in a CSV؛CSV (rules.csv):

first column are the filenames and 2nd column is the subfolder in which I wanna move them to.

FILES   SUBFOLDER
file1.txt   subfolder1
file3.txt   subfolder1
file8.txt   subfolder1
    
file2.txt   subfolder2
file4.txt   subfolder2
file23.txt  subfolder2

file5.txt   subfolder3
file6.txt   subfolder3
file9.txt   subfolder3
file11.txt  subfolder3
file16.txt  subfolder3

file12.txt  subfolder4
file13.txt  subfolder4
file14.txt  subfolder4
file19.txt  subfolder4
file24.txt  subfolder4
file28.txt  subfolder4
file30.txt  subfolder4

file78.txt  subfolder5
file37.txt  subfolder5
file49.txt  subfolder5
file88.txt  subfolder5

That's what I am trying to achieve.

Would there be a way to move these .txt files in their respective subfolders based on a terminal command like "mv" + read these rules from the CSV file mentioned above?(not sure if even possible)

I tried something like this

mv file1.txt,file3.txt,file8.txt* /subfolder1

but seems counterproductive to do it manually for each without the rules :(

I have 1 x big folder that has lots of .txt files

I am trying to group these .txt files in separate subfolders based on a specific roles from a rules.csv file (on what subfolder they belong to):

LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt

The rules would be:

file1.txt
file3.txt
file8.txt

belong to "subfolder1"

file2.txt
file4.txt
file23.txt

belong to "subfolder2"

etc

Here's the list of rules in a CSV؛

first column are the filenames and 2nd column is the subfolder in which I wanna move them to.

FILES   SUBFOLDER
file1.txt   subfolder1
file3.txt   subfolder1
file8.txt   subfolder1
    
file2.txt   subfolder2
file4.txt   subfolder2
file23.txt  subfolder2

file5.txt   subfolder3
file6.txt   subfolder3
file9.txt   subfolder3
file11.txt  subfolder3
file16.txt  subfolder3

file12.txt  subfolder4
file13.txt  subfolder4
file14.txt  subfolder4
file19.txt  subfolder4
file24.txt  subfolder4
file28.txt  subfolder4
file30.txt  subfolder4

file78.txt  subfolder5
file37.txt  subfolder5
file49.txt  subfolder5
file88.txt  subfolder5

That's what I am trying to achieve.

Would there be a way to move these .txt files in their respective subfolders based on a terminal command like "mv" + read these rules from the CSV file mentioned above?(not sure if even possible)

I tried something like this

mv file1.txt,file3.txt,file8.txt* /subfolder1

but seems counterproductive to do it manually for each without the rules :(

I have 1 x big folder that has lots of .txt files

I am trying to group these .txt files in separate subfolders based on specific rules from a rules.csv file (on what subfolder they belong to):

LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt

The rules would be:

file1.txt
file3.txt
file8.txt

belong to "subfolder1"

file2.txt
file4.txt
file23.txt

belong to "subfolder2"

etc

Here's the list of rules in a CSV (rules.csv):

first column are the filenames and 2nd column is the subfolder in which I wanna move them to.

file1.txt   subfolder1
file3.txt   subfolder1
file8.txt   subfolder1
    
file2.txt   subfolder2
file4.txt   subfolder2
file23.txt  subfolder2

file5.txt   subfolder3
file6.txt   subfolder3
file9.txt   subfolder3
file11.txt  subfolder3
file16.txt  subfolder3

file12.txt  subfolder4
file13.txt  subfolder4
file14.txt  subfolder4
file19.txt  subfolder4
file24.txt  subfolder4
file28.txt  subfolder4
file30.txt  subfolder4

file78.txt  subfolder5
file37.txt  subfolder5
file49.txt  subfolder5
file88.txt  subfolder5

That's what I am trying to achieve.

Would there be a way to move these .txt files in their respective subfolders based on a terminal command like "mv" + read these rules from the CSV file mentioned above?(not sure if even possible)

I tried something like this

mv file1.txt,file3.txt,file8.txt* /subfolder1

but seems counterproductive to do it manually for each without the rules :(

deleted 135 characters in body
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 117

I was wondering if I could use a command + regex in the terminal to move files in different subfolders:

I have 1 x big folder that has lots of .txt files

I am trying to group these .txt files in separate subfolders based on a specific patternroles from a rules.csv file (on what subfolder they belong to):

LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt

The rules would be: file1

file1.txt
file3.txt
file8.txt

belong to "subfolder1"

file2.txt
file4.txt
file23.txt

belong to "subfolder2"

etc

Here's the list of rules in a CSV؛

first column are the filenames and 2nd column is the subfolder in which I wanna move them to.

FILES   SUBFOLDER
file1.txt   subfolder1
file3.txt   subfolder1
file8.txt   subfolder1
    
file2.txt   subfolder2
file4.txt   subfolder2
file23.txt  subfolder2

file5.txt   subfolder3
file6.txt   subfolder3
file9.txt   subfolder3
file11.txt  subfolder3
file16.txt  subfolder3

file12.txt  subfolder4
file13.txt  subfolder4
file14.txt  subfolder4
file19.txt  subfolder4
file24.txt  subfolder4
file28.txt  subfolder4
file30.txt  subfolder4

file78.txt  subfolder5
file37.txt  subfolder5
file49.txt  subfolder5
file88.txt  subfolder5

That's what I am trying to achieve. There's no specific pattern based on numbers, the "file1", etc can have other names, so don't look at the numbers in the filenames as a pattern.

Would there be a way to move these .txt files in their respective subfolders based on a terminal command like "mv" + regex + also read these rules from the CSV file mentioned above?(not sure if even possible)

I tried something like this

mv file1.txt,file3.txt,file8.txt* /subfolder1

but seems counterproductive to do it manually for each without the rules :(

I was wondering if I could use a command + regex in the terminal to move files in different subfolders:

I have 1 x big folder that has lots of .txt files

I am trying to group these .txt files in separate subfolders based on a specific pattern (on what subfolder they belong to):

LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt

The rules would be: file1.txt
file3.txt
file8.txt

belong to "subfolder1"

file2.txt
file4.txt
file23.txt

belong to "subfolder2"

etc

Here's the list of rules in a CSV؛

first column are the filenames and 2nd column is the subfolder in which I wanna move them to.

FILES   SUBFOLDER
file1.txt   subfolder1
file3.txt   subfolder1
file8.txt   subfolder1
    
file2.txt   subfolder2
file4.txt   subfolder2
file23.txt  subfolder2

file5.txt   subfolder3
file6.txt   subfolder3
file9.txt   subfolder3
file11.txt  subfolder3
file16.txt  subfolder3

file12.txt  subfolder4
file13.txt  subfolder4
file14.txt  subfolder4
file19.txt  subfolder4
file24.txt  subfolder4
file28.txt  subfolder4
file30.txt  subfolder4

file78.txt  subfolder5
file37.txt  subfolder5
file49.txt  subfolder5
file88.txt  subfolder5

That's what I am trying to achieve. There's no specific pattern based on numbers, the "file1", etc can have other names, so don't look at the numbers in the filenames as a pattern.

Would there be a way to move these .txt files in their respective subfolders based on a terminal command like "mv" + regex + also read these rules from the CSV file mentioned above?(not sure if even possible)

I tried something like this

mv file1.txt,file3.txt,file8.txt* /subfolder1

but seems counterproductive to do it manually for each without the rules :(

I have 1 x big folder that has lots of .txt files

I am trying to group these .txt files in separate subfolders based on a specific roles from a rules.csv file (on what subfolder they belong to):

LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt

The rules would be:

file1.txt
file3.txt
file8.txt

belong to "subfolder1"

file2.txt
file4.txt
file23.txt

belong to "subfolder2"

etc

Here's the list of rules in a CSV؛

first column are the filenames and 2nd column is the subfolder in which I wanna move them to.

FILES   SUBFOLDER
file1.txt   subfolder1
file3.txt   subfolder1
file8.txt   subfolder1
    
file2.txt   subfolder2
file4.txt   subfolder2
file23.txt  subfolder2

file5.txt   subfolder3
file6.txt   subfolder3
file9.txt   subfolder3
file11.txt  subfolder3
file16.txt  subfolder3

file12.txt  subfolder4
file13.txt  subfolder4
file14.txt  subfolder4
file19.txt  subfolder4
file24.txt  subfolder4
file28.txt  subfolder4
file30.txt  subfolder4

file78.txt  subfolder5
file37.txt  subfolder5
file49.txt  subfolder5
file88.txt  subfolder5

That's what I am trying to achieve.

Would there be a way to move these .txt files in their respective subfolders based on a terminal command like "mv" + read these rules from the CSV file mentioned above?(not sure if even possible)

I tried something like this

mv file1.txt,file3.txt,file8.txt* /subfolder1

but seems counterproductive to do it manually for each without the rules :(

added 2 characters in body
Source Link

I was wondering if I could use a command + regex in the terminal to move files in different subfolders:

I have 1 x big folder that has lots of .txt files

I am trying to group these .txt files in separate subfolders based on a specific pattern (on what subfolder they belong to):

LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt

The rules would be: file1.txt
file3.txt
file8.txt

belong to "subfolder1"

file2.txt
file4.txt
file23.txt

belong to "subfolder2"

etc

Here's the list of rules in a CSV؛

first column are the filenames and 2nd column is the subfolder in which I wanna move them to.

FILES   SUBFOLDER
file1.txt   subfolder1
file3.txt   subfolder1
file8.txt   subfolder1
    
file2.txt   subfolder2
file4.txt   subfolder2
file23.txt  subfolder2

file5.txt   subfolder3
file6.txt   subfolder3
file9.txt   subfolder3
file11.txt  subfolder3
file16.txt  subfolder3

file12.txt  subfolder4
file13.txt  subfolder4
file14.txt  subfolder4
file19.txt  subfolder4
file24.txt  subfolder4
file28.txt  subfolder4
file30.txt  subfolder4 

file78.txt  subfolder5
file37.txt  subfolder5
file49.txt  subfolder5
file88.txt  subfolder5

That's what I am trying to achieve. There's no specific pattern based on numbers, the "file1", etc can have other names, so don't look at the numbers in the filenames as a pattern.

Would there be a way to move these .txt files in their respective subfolders based on a terminal command like "mv" + regex + also read these rules from the CSV file mentioned above?(not sure if even possible)

I tried something like this

mv file1.txt,file3.txt,file8.txt* /subfolder1

but seems counterproductive to do it manually for each without the rules :(

I was wondering if I could use a command + regex in the terminal to move files in different subfolders:

I have 1 x big folder that has lots of .txt files

I am trying to group these .txt files in separate subfolders based on a specific pattern (on what subfolder they belong to):

LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt

The rules would be: file1.txt
file3.txt
file8.txt

belong to "subfolder1"

file2.txt
file4.txt
file23.txt

belong to "subfolder2"

etc

Here's the list of rules in a CSV؛

first column are the filenames and 2nd column is the subfolder in which I wanna move them to.

FILES   SUBFOLDER
file1.txt   subfolder1
file3.txt   subfolder1
file8.txt   subfolder1
    
file2.txt   subfolder2
file4.txt   subfolder2
file23.txt  subfolder2

file5.txt   subfolder3
file6.txt   subfolder3
file9.txt   subfolder3
file11.txt  subfolder3
file16.txt  subfolder3

file12.txt  subfolder4
file13.txt  subfolder4
file14.txt  subfolder4
file19.txt  subfolder4
file24.txt  subfolder4
file28.txt  subfolder4
file30.txt  subfolder4
file78.txt  subfolder5
file37.txt  subfolder5
file49.txt  subfolder5
file88.txt  subfolder5

That's what I am trying to achieve. There's no specific pattern based on numbers, the "file1", etc can have other names, so don't look at the numbers in the filenames as a pattern.

Would there be a way to move these .txt files in their respective subfolders based on a terminal command like "mv" + regex + also read these rules from the CSV file mentioned above?(not sure if even possible)

I tried something like this

mv file1.txt,file3.txt,file8.txt* /subfolder1

but seems counterproductive to do it manually for each without the rules :(

I was wondering if I could use a command + regex in the terminal to move files in different subfolders:

I have 1 x big folder that has lots of .txt files

I am trying to group these .txt files in separate subfolders based on a specific pattern (on what subfolder they belong to):

LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt

The rules would be: file1.txt
file3.txt
file8.txt

belong to "subfolder1"

file2.txt
file4.txt
file23.txt

belong to "subfolder2"

etc

Here's the list of rules in a CSV؛

first column are the filenames and 2nd column is the subfolder in which I wanna move them to.

FILES   SUBFOLDER
file1.txt   subfolder1
file3.txt   subfolder1
file8.txt   subfolder1
    
file2.txt   subfolder2
file4.txt   subfolder2
file23.txt  subfolder2

file5.txt   subfolder3
file6.txt   subfolder3
file9.txt   subfolder3
file11.txt  subfolder3
file16.txt  subfolder3

file12.txt  subfolder4
file13.txt  subfolder4
file14.txt  subfolder4
file19.txt  subfolder4
file24.txt  subfolder4
file28.txt  subfolder4
file30.txt  subfolder4 

file78.txt  subfolder5
file37.txt  subfolder5
file49.txt  subfolder5
file88.txt  subfolder5

That's what I am trying to achieve. There's no specific pattern based on numbers, the "file1", etc can have other names, so don't look at the numbers in the filenames as a pattern.

Would there be a way to move these .txt files in their respective subfolders based on a terminal command like "mv" + regex + also read these rules from the CSV file mentioned above?(not sure if even possible)

I tried something like this

mv file1.txt,file3.txt,file8.txt* /subfolder1

but seems counterproductive to do it manually for each without the rules :(

added 537 characters in body; edited tags
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 117
Loading
added 224 characters in body
Source Link
Loading
Source Link
Loading