mv

How to rename with prefix/suffix ?

How do I do mv original.filename new.original.filename without retyping the original filename? I would imagine being able to do something like mv -p=new. original.filename or perhaps mv original.filename new.~ or whatever - but I can't see anything like this after looking at man mv / info mv pages. Of course, I could write a shell scri...

Is there a way to make mv create the directory to be moved to if it doesn't exist?

So, if I'm in my home directory and I want to move foo.c to ~/bar/baz/foo.c , but those directories don't exist, is there some way to have those directories automatically created, so that you would only have to type mv foo.c ~/bar/baz/ and everything would work out? It seems like you could alias mv to a simple bash script that would c...

Unable to move pictures from Desktop to a specific folder

I have pictures from Picture_1.png to Picture_77.png in my Desktop. I am now at a folder called Pictures in terminal. I would like to move the pictures to the folder where I am at the moment. I tried the following code unsuccessfully mv Picture_[1-77].png I am not sure what I should add for the target folder because I am at the targ...

Unable to move all files except directories to a folder in terminal

I have extended regexes enabled in my Bash by shopt -s extglob They may be useful in solving the problem. I run the following unsuccessfully, since it moves also directories $ mv `find . -maxdepth 1` django-tes/ I am trying to find all files except directories and move them to a directory called django-tes/. How can you move all ...

Moving Files and Folders Accidentally to Non-existent Places

I often do the command such as: mv folder $something_that_does_not_exist mv files* $something_that_does_not_exist Then, I realise that my files are gone. I cannot see them even in the folder "$something_that_does_not_exist". Where have my files and folders gone? How can I get them back? ...

[Linux command] How to move a directory

Hi. my old and new directory have same folders and files inside. I try "mv -if old/* new/" and get error mv: cannot move `./xxxxxx' to a subdirectory of itself How can I move it ? (Centos 5) thanks. ...

Unable to convert dot-files to non-dotfiles safely

I run unsuccessfully in Mac mv .* * and mv .* ./* My files disappeared into thin air. How can you convert dot-files to non-dotfiles safely? ...

CAMEL is processing the file before the "mv" command completes

We are facing a problem in our monitor script. The flow of the program is Customer ftp/sftp the file (in .csv format) to "source" directory Bash script renames the completed .csv file to .aaa file Another Bash script moves the ".aaa" file to "destination" directory and renames the file back to ".csv" CAMEL is monitoring the "destinati...

using mdfind how can I append an mv command to the result and escape spaces?

Using apple os 10.5.x I am trying to hunt down font files and move them on client workstations. So far I have: mv $(mdfind -onlyin ~/Desktop/fontRm/ "kMDItemContentType == '*ont*'" | sed -e 's/ /\\ /g') /Users/chrihopk/Desktop/target/ I'm struggling with getting the sed command to escape the spaces before the mv command executes. Tha...

Is it possible to move/rename files in git and maintain their history?

I would like to rename/move a project subtree in git moving it from '/project/xyz' to '/components/xyz' If I use a plain 'git mv project components' then all the file history for the xyz project gets lost. Is there a way to move this such that the history is maintained? ...

How can I stop an auto-generated Linq to SQL class from loading ALL data?

DUPLICATE of http://stackoverflow.com/questions/2433422/how-can-i-stop-an-auto-generated-linq-to-sql-class-from-loading-all-data post answers there! I have an ASP.NET MVC project, much like the NerdDinner tutorial example. (I'm using MVC 2, but followed the NerdDinner tutorial in order to create it). As per the instructions in part 3...

bash script problem, find , mv tilde files created by gedit

Hi, im using linux with gedit which has the wonderful habit of creating a temp file with a tilde at the end for every file I edit. im trying to move all of these files at once to a different folder using the following: find . -iname “*.php~” -exec mv {} /mydir \; However, its now giving me syntax errors, as if it were searching thro...

Unix: command for sudo-mv-chown combo?

I am operating as sudo in a system where I mv a great amount of files and dirs to and fro. Is there a command for the combo? $ sudo -i; # mv hello /home/other; # chown -R other:other /home/other/hello ...

Unix invoke script when file is moved

Hi. I have tons of files dumped into a few different folders. I've tried organizing them several times, unfortunatly, there is no organization structure that consistently makes sense for all of them. I finally decided to write myself an application that I can add tags to files with, then the organization can be custom to the actual orga...

mvc-Ajax.ActionLink Opens page on new window

Hello experts, I have a view with Ajax.ActionLink which calls a controller action and returns a partial view.And i have given UpdateTrargetId as id of div.Now when i click on this link ,view opens on a new page rather than the content place holder.I want to render partial view with in the content place holder.Can i have the solution f...

How to Ensure file copy integrity in Ubuntu

In Ubuntu if a file /A/largefile.foo is moved via 'cp' or 'mv' to /B/largefile.foo, how can I ensure that the entire file is written before attempting to move the file a second time to /C/largefile.foo? Case: 1. An remote automated Script X begins an rsync to destination folder A of a very large file. 2. A cron job on the local machin...

How to emulate cp and mv --parent on osx

Osx mv and cp does not have the --parents option, so how does one emulate it ? I.e. mv x/y/a.txt s/x/y/a.txt when s is empty gives a no directory found error unless one does a mkdir first which is rather cumbersome when trying to do this did thousands of files. ...

How can I rewrite history so that all files are in a subdirectory?

I have a project under git. One day I moved all project files from current directory to foo/bar/ under the project. I did it using git mv. Then I added some more files and did some changes to already existing files. As a result, now when I look at the history of foo/bar/file.c, I can only see changes that I did after I moved the file. ...