Export files according to text file

GhostY5406

New Member
Joined
Jun 21, 2021
Messages
3
Reaction score
0
Credits
24
Hi,

I have a file with a list of "uniques IDs" , on the same server (asterisk) i have recording files, i want to export all the recording files according to the list in the text file.
How can i do that ?
 


Can you provide a little more information please?

What do you mean by "export" the recordings?
Is this a simple case of copying files from one place to another? Or will this require you to run a program, or a database query to extract the recordings before copying them somewhere? Or something else?!

Also, what do the entries in the text file look like? And how do they relate to/correspond with the recording files?!

With a little more information, the community here should be able to help you to write a bash script to do what you need.

But with the little information you have given so far, you may as well be asking "How long is a piece of string?".
 
Last edited:
Hi and thanks for your reply.
I have a folder with recording files named by an unique ID.
I want to copy some of them and I have the list of the unique IDs I want to copy from this folder (not all of them).
So I want to copy from this folder only the unique IDs I have in my txt file.
 
You can try it with this :
Code:
for /F %a in (input.txt) do @echo cp %a ./newfolder/%~nxa
it should read all lines in input.txt and copy them to newfolder, preserving the filenames as they are in input.txt.
found this solution for a simular question in Windows but should work in Linux as well...
 
You can try it with this :
Code:
for /F %a in (input.txt) do @echo cp %a ./newfolder/%~nxa
it should read all lines in input.txt and copy them to newfolder, preserving the filenames as they are in input.txt.
found this solution for a simular question in Windows but should work in Linux as well...



Thank you i will try.
 
Or something like this:
Bash:
while read -r file ; do cp "$file" /path/to/outputDirectory  ; done < /path/to/listOfFilenames.txt

Above uses a while loop and file redirection to read each line of the text file and copies each file to the new location.
Substitute /path/to/outputDirectory with the path to the directory you want the files copied to.
And substitute /path/to/listOfFilenames.txt with the path/filename of the file containing the list of filenames you want to copy.
 

Members online


Latest posts

Top