how to find complete path of a file in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to find complete path of a file in unix
# 1  
Old 07-24-2008
MySQL how to find complete path of a file in unix

hi experts(novice people can stay away as it is no child's game),

i am developing a script which works like recycle bin of windows.

the problem i am facing is that when ever i am trying to delete a file which is situated in parent directory or parent's parent directory i am unable to capture the path of the file.

eg:--

i am presently working in /fs/home/u1/proj

and i am trying to delete files of parent directory or parent's parent directory as shown below......

/fs/home/u1/proj> rm ..file1

dont get confused as "rm" has been aliased with "mv" command which will move the "file1" to a directory called "recyclebin".....

My intention is to move the file1 along with its complete path so that i can retreive it back to the original directory from where it got deleted as happens in Windows(Recycle bin)........

hope there is some command such as "dirname" or something of that sort....

Thanks in advance....................

Last edited by yahoo!; 07-24-2008 at 08:21 AM.. Reason: it does not make sense
# 2  
Old 07-24-2008
You can check if your operating system supports the locate command;
else you can use the find command.
# 3  
Old 07-24-2008
Code:
 
man find

should point you to what you need
# 4  
Old 07-24-2008
if you are in the directory the file is in the pwd command would show the "Present Working Directory" wouldnt this be what you want?

Code:
"i am presently working in /fs/home/u1/proj"

#> pwd
/fs/home/u1/proj

# 5  
Old 07-25-2008
hi experts,,,,,,,,,,

i am expecting relevent solution..... and pwd is not the command that i am looking for............... how can i develope the code without knowing the basic command i.e., "pwd"

i agree my project is a bit complex but still there is hope of finding a solution................

Thanks in advance............
# 6  
Old 07-25-2008
Did you try it out with find as stated twice above?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find and Replace Path in UNIX

Hi All, How can i find and replace the one path to another path with in the file. For Example: Search_path=/search/path replace_path=/replace/path I used the following command but not usefull, please help me regarding the same. sed 's_/search/path_/replace/path_' file_name >... (6 Replies)
Discussion started by: nsyed.dw
6 Replies

2. Shell Programming and Scripting

Unix Scripting : Sort a Portion of a File and not the complete file

Need to sort a portion of a file in a Alphabetical Order. Example : The user adam is not sorted and the user should get sorted. I don't want the complete file to get sorted. Currently All_users.txt contains the following lines. ############## # ARS USERS ############## mike, Mike... (6 Replies)
Discussion started by: evrurs
6 Replies

3. Shell Programming and Scripting

How to find complete file names in UNIX if i know only extention of file

Suppose I have a file which contains other file names with some extention . text file containt gdsds sd8ef g/f/temp_temp.sum yyeta t/unix.sum ghfp hrwer h/y/test.text.dat if then.... I want to get the complete file names, like for above file I should get output as temp_temp.sum... (4 Replies)
Discussion started by: panchal
4 Replies

4. UNIX for Dummies Questions & Answers

How to get complete path in variable excluding last word?

Hello Experts, Can you please help me by providing a code which can give me the complete path except last word in a variable, the variable i can use anywhere else for my operation eg: if this below one is my path: ... (3 Replies)
Discussion started by: aks_1902
3 Replies

5. Shell Programming and Scripting

How to a find a file in which path it is there?

Hi Firends, Good Morning to all, I want a find command to search a paticular file present in my system(ie search through under all users and all directories.) I am looking forward from you.:) Advance Thanks, Siva Ranganath CH (3 Replies)
Discussion started by: sivaranga001
3 Replies

6. UNIX for Dummies Questions & Answers

Find unix path to a file?

I know this is very newbie ... but I need help determining the proper file path to file...Have no idea how to do this I'm on a Mac OS X 10.6 Snow Leopard thanks very much (4 Replies)
Discussion started by: jmarc
4 Replies

7. UNIX for Dummies Questions & Answers

how to find a path within unix root directory

I need to know whether nyfile/mypath exists on the file system in the root directory. How to do this (1 Reply)
Discussion started by: ramky79
1 Replies

8. UNIX for Advanced & Expert Users

how to find complete path of a file in unix

hi experts(novice people can stay away as it is no child's game), i am developing a script which works like recycle bin of windows. the problem i am facing is that when ever i am trying to delete a file which is situated in parent directory or parent's parent directory i am unable to capture... (1 Reply)
Discussion started by: yahoo!
1 Replies

9. HP-UX

URGENT: UNIX FTP cannot find path error

Dear all We are currently working on to install some ERP system in wjhich we need to FTP from unix to windows 2000 machine We run ./lodrun to get files from d/xxxxx/xxxx directory but the ftpoutput.log file shows following error FTP: xxxxxxxxx system cannot find the path specified... (1 Reply)
Discussion started by: minix
1 Replies

10. UNIX for Advanced & Expert Users

ls -R command but need complete path name on each line

Can anyone help me with the following: I need to traverse subdirectories to create a list of files with the pathname. For example, here's what I get with a simple ls -alR command: /MAIN/data/30007390 dte2>>ls -alR .: total 2 drwxrwx--- 4 ecfadmin staff 96 Oct 24 18:35 . ... (2 Replies)
Discussion started by: condor4-2
2 Replies
Login or Register to Ask a Question

Featured Tech Videos