About 8,030,000 results
Open links in new tab
  1. How to move or copy files listed by 'find' command in unix?

    Jun 28, 2013 · Syntax: find <Path> <Conditions> | xargs cp -t <copy file path> Example: find -mtime -1 -type f | xargs cp -t inner/ But our production data files might contain spaces, so most of time this command is effective:

  2. linux - Find and copy files - Stack Overflow

    Aug 15, 2012 · Actually, in two ways you can process find command output in copy command. If find command's output doesn't contain any space i.e if file name doesn't contain space in it then you can use below mentioned command: Syntax: find <Path> <Conditions> | xargs cp -t <copy file path> Example: find -mtime -1 -type f | xargs cp -t inner/

  3. Linux ‘find’ command: How to find and copy files

    Nov 27, 2017 · In short, here's the find command I used to find and copy all of those files: find . -type f -name "*.mp3" -exec cp {} /tmp/MusicFiles \; If you're familiar with the find command and have used the -exec option before, the only thing hard about this command is knowing where to put the curly braces and the \; in the command.

  4. linux - find and copy file using Bash - Stack Overflow

    I would recommend using find's -exec option: find . -ctime 15 -exec cp {} ../otherfolder \; As always, consult the manpage for best results.

  5. How to Find a File in Linux | Find Command - GeeksforGeeks

    Apr 11, 2025 · Using the find command is straightforward. To find a file in Linux, open a terminal and use the following basic syntax: Replace “/path/to/search" with the directory where you want to start the search and customize the options and criteria based on your requirements. For example :

  6. linux - How do I use find to copy all found files to a new name in ...

    The following will locate all files with a suffix of '_compressed.swf' and copy each into its same directory with a '.bak2' appended: find '../content' -name '*_compressed.swf' -print0 | xargs -0 -I {} cp {} {}.bak2

  7. Copying Files With Different Specific Extensions Using the

    Mar 18, 2024 · In this article, we looked at how to use the find command to locate and copy files with specific extensions. We learned how to combine logical operators and expressions to search for files based on various criteria, including type, name, extension, or regular expressions.

  8. How To Find and Copy Certain Type Of Files From One Directory To ...

    Feb 28, 2017 · find - It's the command to find files and folders in Unix-like systems. -iname '*.mp3' - Search for files matching with extension .mp3. -exec cp - Tells you to execute the 'cp' command to copy files from source to destination directory. {} - is automatically replaced with the file name of the files found by 'find' command.

  9. How copy and rename files found in "find" function Linux?

    You can find, copy, and rename files in oneliner command with -exec sh: find /home/user/temps -name thumb.png \ -exec sh -c 'cp "{}" "$(basename "$(dirname "{}")")_$(basename "{}")"' \; (The extra " are meant to deal with copying files with spaces).

  10. How to combine find and cp in linux to copy specific files

    May 20, 2022 · I would use xargs to copy all files. You can pipe the output to xargs which executes cp to all passed arguments. The Wikipedia article describes xargs better than I could do and you could look into the manpage of Linux. A call that does what you want could be: find /mydir -type f -name 'log*.txt' | tail -n 10 | xargs -I % cp % /tmp/mydir/

  11. Some results have been removed
Refresh