mv directories question


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers mv directories question
# 1  
Old 01-25-2010
mv directories question

I'm really new to Unix and its commands. I tried to move a file from the home directory to another one but I didn't type the full name of the new directory. I think the computer created another directory in the home directory and put it in there. However, now I can't access it and it doesn't even say its a directory. Is there any way to fix this?
# 2  
Old 01-25-2010
Unless a directory pre-existed in you home directory , the effect will likely have been that your original file was renamed to (a file with) the same name as your intended target directory.

So with "targetdirname" being the new name of the wrongfully renamed file:
Code:
mv targetdirname originalfilename

should suffice to reverse the operation and rename it back to originalfilename.
# 3  
Old 01-25-2010
What happens if I renamed multiple files to the same name? I accidentally did this thinking I was moving them to a new directory.

Last edited by scheng12; 01-25-2010 at 10:54 PM..
# 4  
Old 01-26-2010
The mv command will not do that. If the last argument is not a directory it will say: "not a directory". If in fact you issued the command in your home directory without a path ans it succeeded, then there should be a pre-existing directory there with the same name as the intended target directory. And in there you should see your files. Otherwise look at your command history to see what you have done. Failing that you can do a find in your home directory.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Giving read write permission to user for specific directories and sub directories.

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. This is for Solaris. Please help. (1 Reply)
Discussion started by: blinkingdan
1 Replies

2. UNIX for Dummies Questions & Answers

Linux question on directories..

Hi, First server every thing is working but keeps crashing so to be on the safe side created second server and moved all the files. But I notice there is a " dot " at the end. See below. Not sure what that means. Also getting 403 on Apache. Please see below. Thanks you so much. ls -l... (4 Replies)
Discussion started by: samnyc
4 Replies

3. UNIX for Dummies Questions & Answers

List the directories, having given pattern in the directories name, sorted by creation date

It is for HP-Unix B.11.31. Requirement: 1. List the directories, having given pattern in the directories name, sorted by creation date. Example: Directories with name "pkg32*" or "pkg33*" 2. On the output of 1. list the directories by creation date as sort order, with creation date... (2 Replies)
Discussion started by: Siva SQL
2 Replies

4. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

5. UNIX for Dummies Questions & Answers

Using grep command to find the pattern of text in all directories and sub-directories.

Hi all, Using grep command, i want to find the pattern of text in all directories and sub-directories. e.g: if i want to search for a pattern named "parmeter", i used the command grep -i "param" ../* is this correct? (1 Reply)
Discussion started by: vinothrajan55
1 Replies

6. Shell Programming and Scripting

question on blackslashes and slashes in directories

Since I'm usually on windows I've came across different shells like Cygwin, Hamilton, and MKS. I've been working in csh most of the time, so porting scripts from one shell to another can be fairly annoying and confusing. When specifying a directory I noticed that certain shells do not recognize... (1 Reply)
Discussion started by: vas28r13
1 Replies

7. Programming

question about empty directories in unix system

how is it possible for a directory to be empty and still have a size greater than 0 in bytes... i made a shell script that shows info about all files/directories and this is what came up the last one is the size, here its showing 1024 in the for loop i did something like for h in * .*; do ... (4 Replies)
Discussion started by: omega666
4 Replies

8. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

9. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies
Login or Register to Ask a Question