cp

Copy all java files to specified folder

喜你入骨 提交于 2020-07-23 06:40:58
问题 I have a input path src and output path dest . src can have multiple sub-directories, which can again have further sub-directories and so on. I want to copy all java files (and directories that contain them) from src to dest "as-is". That is, if src was: src - f1.java f4.txt dir_1 - f2.java dir_2 - f3.java dir_3 - f5.txt dest should look like: dest - f1.java dir_1 - f2.java dir_2 - f3.java I tried: cp src/*.java dest But it only copies f1.java , and nothing else. Can someone please help me

Copy all java files to specified folder

Deadly 提交于 2020-07-23 06:38:33
问题 I have a input path src and output path dest . src can have multiple sub-directories, which can again have further sub-directories and so on. I want to copy all java files (and directories that contain them) from src to dest "as-is". That is, if src was: src - f1.java f4.txt dir_1 - f2.java dir_2 - f3.java dir_3 - f5.txt dest should look like: dest - f1.java dir_1 - f2.java dir_2 - f3.java I tried: cp src/*.java dest But it only copies f1.java , and nothing else. Can someone please help me

What is cp: cannot stat error in Unix, I get this error when trying to copy thing from one folder to another

◇◆丶佛笑我妖孽 提交于 2020-05-12 11:06:29
问题 Hi I wanted to know why I am getting this error. I have this directory called mock, which inside has another 3 directories. I am trying to copy all the items from mock directory into the projweek directory using the below code. cp /mock/* ~/projweek But I get this error cp: cannot stat ‘mock/*’: No such file or directory any ideas as to why that is? 回答1: If your source directory is set in quotes, then make sure that the * is outside the quotes, i.e. cp "source/"* dest or cp "source"/* dest

How to perform a cronjob only when a file is greater than a certain size?

旧城冷巷雨未停 提交于 2020-03-25 12:30:32
问题 The following script (credit to Romeo Ninov) selects the most recent directory and performs a cp operation: dir=$(ls -tr1 /var/lib/test|tail -1) cd /var/lib/test/$dir && cp *.zip /home/bobby/ Please see: How can I use a cronjob when another program makes the commands in the cronjob fail? for the previous question. I would like to modify this so that the cp only happens if the .zip file is larger than a defined byte size e.g. 28,000 bytes. If the .zip file is smaller, nothing is copied. As

Find, copy, rename within the same directory

百般思念 提交于 2020-01-25 06:04:04
问题 I an new to bash and could do with some help. I am looking to create a command that will instantly duplicate the last created file with a new new. So far I come up with the following command; find /home/ian/Desktop/TEST/ -type f -mmin -1 -exec echo cp {} /home/ian/Desktop/TEST/ \; But for the life or me I cannot find a way to rename the file and I have looked around and tried various methods but none seemed to work. I would like to have control over the renaming so that I can add '_backup' to

Subprocess cp returns error - bufsize must be integer [duplicate]

删除回忆录丶 提交于 2020-01-14 07:35:07
问题 This question already has an answer here : bufsize must be an integer error while grepping a message (1 answer) Closed 4 years ago . I'm trying to copy from one directory to another, and rename them at the same time by calling 'cp' like so: directories = ['/Users/Me/Folder1/File1.txt', '/Users/Me/Folder/File2.txt'] output = ['/Users/Me/Folder2/Hello.txt', 'Users/Me/Folder2/World.txt'] for in, out, in zip(directories, output): subprocess.call('cp', in, out) But it returns: File "./test.py",

Problems with command using * wildcard in subprocess

牧云@^-^@ 提交于 2020-01-09 11:44:28
问题 I'm trying to copy files from one location to another using subprocess library and Popen method. When runing following script I'm getting the error cp: cannot stat /some/dev_path/* . I was told that the * is not expanded to the file names and that's where the problem is. Also in some other posts people were suggesting to use call instead of Popen, but call will not return stderr as far as I know. devPath = '/some/dev_path/' productionPath = '/some/prod_path/' p = subprocess.Popen(['cp', '-r',

No such file or directory when 'cp' but not with 'ls'

…衆ロ難τιáo~ 提交于 2020-01-07 16:59:04
问题 I am trying to copy the shared preferences folder of my app to the /sdcard partition from my PC using the following ADB command: adb shell su -c "cp /data/data/com.anrapps.pixelbatterysaver/shared_prefs/ /sdcard/appdata/" But this returns cp: Skipped dir '/data/data/com.anrapps.pixelbatterysaver/shared_prefs': No such file or directory . However when executing the ls command, it says that folder is present: adb shell su -c "ls /data/data/com.anrapps.pixelbatterysaver" cache code_cache files

No such file or directory when 'cp' but not with 'ls'

≯℡__Kan透↙ 提交于 2020-01-07 16:58:11
问题 I am trying to copy the shared preferences folder of my app to the /sdcard partition from my PC using the following ADB command: adb shell su -c "cp /data/data/com.anrapps.pixelbatterysaver/shared_prefs/ /sdcard/appdata/" But this returns cp: Skipped dir '/data/data/com.anrapps.pixelbatterysaver/shared_prefs': No such file or directory . However when executing the ls command, it says that folder is present: adb shell su -c "ls /data/data/com.anrapps.pixelbatterysaver" cache code_cache files

No such file or directory when 'cp' but not with 'ls'

痞子三分冷 提交于 2020-01-07 16:58:06
问题 I am trying to copy the shared preferences folder of my app to the /sdcard partition from my PC using the following ADB command: adb shell su -c "cp /data/data/com.anrapps.pixelbatterysaver/shared_prefs/ /sdcard/appdata/" But this returns cp: Skipped dir '/data/data/com.anrapps.pixelbatterysaver/shared_prefs': No such file or directory . However when executing the ls command, it says that folder is present: adb shell su -c "ls /data/data/com.anrapps.pixelbatterysaver" cache code_cache files