Copying multiple files in a different location
61 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a bunch of files(around 1000) with the audio signals in them and I am trying to copy-paste them in another direction ( another folder). I would like to paste them with the same names but I do not want to use the dir function. Can anyone advise what other options do I have?
Many thanks in advance.
12 comentarios
Walter Roberson
el 7 de Oct. de 2020
Editada: Walter Roberson
el 7 de Oct. de 2020
If they all start with a common prefix and have a common suffix then you can use copyfile with wildcards. For example,
copyfile('B*.wav', '../save_the_waves/')
Just make sure that the destination directory exists first.
Respuestas (1)
Walter Roberson
el 7 de Oct. de 2020
copy with the ls all the files and audio signals into another location
destination_directory = '../copy_of_files';
if ~exist(destination_directory, 'dir')
mkdir(destination_directory);
end
copyfile( '*.wav', destination_directory)
copyfile( '*.jpg', destination_directory);
5 comentarios
Walter Roberson
el 8 de Oct. de 2020
Example1 and example2 appear to be directories (also known as folders) rather than files ??
Are you sure you are not permitted to use dir() ? When you do not know the directory and file names ahead of time, dir() is the best way to proceed. There are cases where ls can output misleading filenames.
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!