mv

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

Is there an scp variant of mv command? [closed]

孤街浪徒 提交于 2020-03-14 07:34:45
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am writing a script that will move files from a local system to a remote system. It must do so through an encrypted channel like ssh. What is the best way to do this? I can perform this in two steps like: scp *.jpg user@ip: rm *.jpg But, that is not an atomic process (like mv is for a local filesystem). If the

Recursively rename files to ASCII Standard

依然范特西╮ 提交于 2020-02-15 10:05:10
问题 So we have a problem where we need to crawl through hundreds of thousands of images and rename all of them to comply with ASCII standards. After doing a lot of research online, we found this handy piece of code: mv 'file' $(echo 'file' | sed -e 's/[^A-Za-z0-9._-]/_/g') sourced from: How to remove invalid characters from filenames I have tried merging it into a recursive find command, to be run whilst in our main images directory: find . -print0 | xargs -0 mv $(echo | sed -e 's/[^A-Za-z0-9._-]

Read filenames from CSV and then copy the files to different directory

筅森魡賤 提交于 2020-01-06 15:05:14
问题 I have been able to write a batch file to find files and put the file paths into a CSV. I haven't been able to figure out how to read the file locations from the CSV and then move the files to a different storage device with the same folder structure using python. This is what I'd like to do. I wish I had some code to show you but none of it has worked. 回答1: Here's a quick and dirty solution. (I haven't tested it yet, YMMV!) import csv import os import shutil import sys def main(argv): # TODO

Using mv command won't recognize * as wildcard

我的梦境 提交于 2020-01-06 12:42:49
问题 I have this script, and I know the awk command in it works, but when I want to save the output using the same name of the file it used to do the task using the mv command the * is not used as a wildcard but instead as a character and I end up with a file with a name like this: Algeria_BER_*_sites.txt The script: #!/bin/bash for i in Algeria_BER do echo awk 'FNR==NR{a[++i]=$0;next} {print a[FNR] RS $0}' \ reduced_filt_MAF_b37_chr1_${i}_ldhat.txt_names ${i}_*_sites.txt > $$.tmp && mv $$.tmp "$

Is there any shortcut to reference the path of the first argument in a MV command?

你离开我真会死。 提交于 2019-12-29 05:21:11
问题 I often find myself using mv to rename a file. E.g. mv app/models/keywords_builder.rb app/models/keywords_generator.rb Doing so I need to write (ok, tab complete) the path for the second parameter. In this example it isn't too bad but sometimes the path is deeply nested and it seems like quite a bit of extra typing. Is there a more efficient way to do this? 回答1: You can use history expansion like this: mv app/modules/keywords_builder.rb !#^:h/keywords_generator.rb ! introduces history

Move files according to number in filename

夙愿已清 提交于 2019-12-25 07:14:58
问题 I am trying to move files in folders according to a number in their names. Files are names like fooNNN_bar.txt I would like to organise them like /NNN/fooNNN_bar.txt Here is what I have for now. It prints me the folder each file would have to move to. I'm not sure how to collect the number to add it into a mv command. Is this even the correct way to do it? #!/bin/bash for filename in foo*.txt; do echo "${filename}" | grep -Eo '[0-9]{1,4}'; done 回答1: Assuming your grep works as you want: #!

how do I move specific files from one directory to other using xargs?

强颜欢笑 提交于 2019-12-24 05:37:24
问题 suppose I type this command: find /etc/info/ -name ".c" | xargs -I {} grep -l 'importantFile' {} Now I have all the files that I am interested, which has the suffix of .c and keywords "importantFile". How do I move it to one of my current directory(name: folder)? I tried: find /etc/info/ -name ".c" | xargs -I {} grep -l 'importantFile' {} mv{} ./folder and it doesn't work. Please help :p 回答1: If you like to stick with find, something like this should work: xargs -r0 --arg-file <(find . -name

Executing 'mv A B': Will the 'inode' be changed?

无人久伴 提交于 2019-12-23 12:20:03
问题 If we execute a command: mv A B then what will happen to the fields in the inode of file A? Will it change? I don't think that it should change just by changing the name of the file, but I'm not sure. 回答1: It depends at least partially on what A and B are. If you're moving between file systems, the inode will almost certainly be different. Simply renaming the file on the same system is more likely to keep the same inode simply because the inode belongs to the data rather than the directory

How to use mv command to rename multiple files in unix?

余生颓废 提交于 2019-12-22 06:08:07
问题 I am trying to rename multiple files with extension xyz[n] to extension xyz example : mv *.xyz[1] to *.xyz but the error is coming as - " *.xyz No such file or directory" 回答1: Don't know if mv can directly work using * but this would work find ./ -name "*.xyz\[*\]" | while read line do mv "$line" ${line%.*}.xyz done 回答2: Let's say we have some files as shown below.Now i want remove the part -(ab...) from those files. > ls -1 foo* foo-bar-(ab-4529111094).txt foo-bar-foo-bar-(ab-189534).txt foo