mv

Permissions required to move file to different directory in Unix/Linux [closed]

最后都变了- 提交于 2019-12-03 05:24:32
I would like clarification on the permissions required, in order to move a file A from directory B to directory C (the command would be "mv B/A C/A", I think), with name unchanged. Am I correct to think that the following are required? The user/group doing the move must have write permission for directory B (or B must have permission flag set to allow all users/groups to write it) The user/group doing the move must have write permission for directory C (or C must have permission flag set to allow all users/groups to write it) The user/group doing the move must have write permission for file A

Find files, rename in place unix bash

人走茶凉 提交于 2019-12-03 03:07:12
This should be relatively trivial but I have been trying for some time without much luck. I have a directory, with many sub-directories, each with their own structure and files. I am looking to find all .java files within any directory under the working directory, and rename them to a particular name. For example, I would like to name all of the java files test.java . If the directory structure is a follows: ./files/abc/src/abc.java ./files/eee/src/foo.java ./files/roo/src/jam.java I want to simply rename to: ./files/abc/src/test.java ./files/eee/src/test.java ./files/roo/src/test.java Part of

mv equivalent rsync command [closed]

百般思念 提交于 2019-12-02 21:36:17
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. i'm trying to move folders to another folders using command line , with overwrite if already exists, but i got error "Is a directory" when using mv.. example: mv src/test/ dest/ there are many files and folders on src/test/, there are also some files and some folders on dest/ and i want files and folders on dest/ replaced with files and folder from src/test/ if exists , example: src/test/bla/boo replaces dest/bla/boo src

Rename part of file name based on exact match in contents of another file

删除回忆录丶 提交于 2019-12-02 20:16:25
问题 I would like to rename a bunch of files by changing only one part of the file name and doing that based on an exact match in a list in another file. For example, if I have these file names: sample_ACGTA.txt sample_ACGTA.fq.abc sample_ACGT.txt sample_TTTTTC.tsv sample_ACCCGGG.fq sample_ACCCGGG.txt otherfile.txt and I want to find and replace based on these exact matches, which are found in another file called replacements.txt: ACGT name1 TTTTTC longername12 ACCCGGG nam7 ACGTA another4 So that

Python move files from directories that match given criteria to new directory

房东的猫 提交于 2019-12-02 09:48:05
I have a directory that looks something like this: . ├── files.py ├── homework ├── hw1 │ └── hw1.pdf ├── hw10 │ └── hw10.pdf ├── hw13 │ └── hw13.pdf ├── hw2 │ └── hw2.pdf ├── hw3 │ └── hw3.pdf ├── hw4 │ └── hw4.pdf ├── hw7 │ └── hw7.pdf ├── IntroductionToAlgorithms.pdf ├── p157 │ └── Makefile ├── p164 │ └── project ├── p171 │ ├── project ├── p18 │ └── project ├── p246 │ ├── project ├── p257 │ ├── project ├── p307 │ ├── project ├── p34 │ └── project ├── p363 │ ├── project ├── p431 │ ├── bit_buffer.h ├── p565 │ ├── project ├── p72 │ └── project ├── README.md └── tree.txt I want to move all the

Moving large number of large files in git repository

自作多情 提交于 2019-12-02 01:08:27
问题 My repository has large number of large files. They are mostly data (text). Sometimes, I need to move these files to another location due to refactoring or packaging. I use git mv command to "rename" the path of the files, but it seems inefficient in that the size of the commit (the actual diff size) is very huge, same as rm , git add Is there other ways to reduce the commit size? or should I just add them to .gitignore and upload as a zip file to upstream? Thank you for the answers. FYI,

Recursively rename files to ASCII Standard

戏子无情 提交于 2019-12-02 00:26:45
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._-]/_/g') But i cant seem to get it to run. The closest i've gotten, is the above code throwing a lot of

How to move file from one folder to different folder in linux

天大地大妈咪最大 提交于 2019-11-30 09:40:18
问题 How to move a particular file from one folder to another folder? What I have tried, #include <stdio.h> int main() { FILE *tFile; if (tFile != NULL) tFile = NULL; if ((tFile = fopen("TempFile.txt", "rw")) == NULL) { return -1; } mv("TempFile.txt", "../MST"); printf("Done Succesfully\n"); return 0; } Error : test.c:17:2: warning: no newline at end of file /tmp/ccKLWYNa.o(.text+0x5e): In function `main': : undefined reference to `mv' collect2: ld returned 1 exit status Please guide me how can I

How to use 'mv' command to move files except those in a specific directory?

半城伤御伤魂 提交于 2019-11-29 20:37:38
I am wondering - how can I move all the files in a directory except those files in a specific directory (as 'mv' does not have a '--exclude' option)? Lets's assume the dir structure is like, |parent |--child1 |--child2 |--grandChild1 |--grandChild2 |--grandChild3 |--grandChild4 |--grandChild5 |--grandChild6 And we need to move files so that it would appear like, |parent |--child1 | |--grandChild1 | |--grandChild2 | |--grandChild3 | |--grandChild4 | |--grandChild5 | |--grandChild6 |--child2 In this case, you need to exclude two directories child1 and child2 , and move rest of the directories in

Spring mvc Ambiguous mapping found. Cannot map controller bean method

一笑奈何 提交于 2019-11-29 02:53:26
I am trying to build an app which can list some values from the database and modify, add, delete if necessary using Spring 4 and i receive the following error(only if the "@Controller" annotation is present in both of my controller files, if i delete the annotation from one of the files it works but i get a message in console "no mapping found ... in dispatcherservlet with name ...): INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/edit/{id}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String