Automating file transferring from multiple source folders to one target folder

Omar Ali

I need to move different files from different folders to a new folder using a command line. The files share the same format .asc: for example, there are files 20file1.asc, 20file2.asc and 20file3.asc existing in folder1, folder2 and folder3 respectively. I simply need to move the .asc from all folders to new folder which is folder4. Each folder is named following a yyyymmdd scheme.

Thanks

tymik

I would use simple script for that, like this one:

for x in {folder1,folder2,folder3}; do mv $x/*.asc folder4/; done

This script assumes you're in path that has folder1,folder2,folder3 in it. You can tune it up to your needs.

For all folders in specific place you can do:

ls -1 >> file
for x in `cat file`; do mv $x/*.asc folder4/; done

But be aware, that ls -1 will also contain files and if there are also files in that folder, you will get errors for these files, saying that path does not exist.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Copying specifig files from multiple folders to one target folder?

From Dev

Shell Script: Copy first file from multiple folders into one single folder

From Dev

Fedora terminal: Extract single files from multiple folders into one folder?

From Dev

Powershell copy a file from source to target but maintain folder structure

From Dev

Transferring multiple files from one host to another

From Dev

Python - Writing Multiple Monthly CSV Files from One Large CSV File - Automating Filenames to Reflect Month

From Dev

Transferring creation date from one file to another

From Dev

Transferring a variable from one file to another

From Dev

Python: Copy identical .csv files from various folders (each folder has one .csv file) into a single folder

From Dev

Python: Copy identical .csv files from various folders (each folder has one .csv file) into a single folder

From Dev

Copy one file to all folders in a folder?

From Dev

Rsync from multiple folders to one

From Dev

Copy files from one folder to multiple other folders where these files originally came from. Windows

From Dev

Batch command to delete everything (sub folders and files) from a folder except one file

From Dev

Ubuntu One Sync for multiple folders in Windows, not just the Ubuntu One folder

From Dev

Ubuntu One Sync for multiple folders in Windows, not just the Ubuntu One folder

From Dev

Java Servlet upload one file to multiple folders

From Dev

Copy one file to multiple folders with grunt

From Dev

Java Servlet upload one file to multiple folders

From Dev

Transferring all staged files, folder etc. from one branch to another in one go

From Dev

Transferring all staged files, folder etc. from one branch to another in one go

From Dev

Copy multiple sub-folders to one folder with PowerShell

From Dev

Copy files from multiple folders into one

From Dev

Gulp: copy files from multiple folders into one

From Dev

Copy multiple files from multiple folders to a single folder using R

From Dev

How to Load multiple angular2 components from different folders in one index.html file?

From Dev

Creating a folder and multiple sub-folders with a batch file

From Dev

read multiple file from folder

From Dev

How to move missing files only from source to target folder

Related Related

  1. 1

    Copying specifig files from multiple folders to one target folder?

  2. 2

    Shell Script: Copy first file from multiple folders into one single folder

  3. 3

    Fedora terminal: Extract single files from multiple folders into one folder?

  4. 4

    Powershell copy a file from source to target but maintain folder structure

  5. 5

    Transferring multiple files from one host to another

  6. 6

    Python - Writing Multiple Monthly CSV Files from One Large CSV File - Automating Filenames to Reflect Month

  7. 7

    Transferring creation date from one file to another

  8. 8

    Transferring a variable from one file to another

  9. 9

    Python: Copy identical .csv files from various folders (each folder has one .csv file) into a single folder

  10. 10

    Python: Copy identical .csv files from various folders (each folder has one .csv file) into a single folder

  11. 11

    Copy one file to all folders in a folder?

  12. 12

    Rsync from multiple folders to one

  13. 13

    Copy files from one folder to multiple other folders where these files originally came from. Windows

  14. 14

    Batch command to delete everything (sub folders and files) from a folder except one file

  15. 15

    Ubuntu One Sync for multiple folders in Windows, not just the Ubuntu One folder

  16. 16

    Ubuntu One Sync for multiple folders in Windows, not just the Ubuntu One folder

  17. 17

    Java Servlet upload one file to multiple folders

  18. 18

    Copy one file to multiple folders with grunt

  19. 19

    Java Servlet upload one file to multiple folders

  20. 20

    Transferring all staged files, folder etc. from one branch to another in one go

  21. 21

    Transferring all staged files, folder etc. from one branch to another in one go

  22. 22

    Copy multiple sub-folders to one folder with PowerShell

  23. 23

    Copy files from multiple folders into one

  24. 24

    Gulp: copy files from multiple folders into one

  25. 25

    Copy multiple files from multiple folders to a single folder using R

  26. 26

    How to Load multiple angular2 components from different folders in one index.html file?

  27. 27

    Creating a folder and multiple sub-folders with a batch file

  28. 28

    read multiple file from folder

  29. 29

    How to move missing files only from source to target folder

HotTag

Archive