Take a files' path with the command 'file' ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Take a files' path with the command 'file' ?
# 1  
Old 10-27-2010
Tools Take a files' path with the command 'file' ?

When I type 'man file' I can read an option named --location but when I give
file --location <filename> doesn't output me the location of the file. Do I do it wrong?Smilie
# 2  
Old 10-27-2010
Seems strange. The primary purpose of file is to put out the interpretation of the file magic as a file type. I thought maybe location just means parrot the file argument as given, even if there is just one file, like grep, but file already does that.

Which O/S is this man file on?
# 3  
Old 10-27-2010
Ubuntu Linux.
I am not really interested in 'file' command. I just need a way to get a file's path becauz I am building a console application that moves the files to the Trash and does not remove them permanently as 'rm' does, but the Trash needs the file's path to restore it if needed. This path is saved at a log file, and so I have to write in this log file the "deleted" file's path.
# 4  
Old 10-27-2010
I am not sure where umbutu saves the Trash'd file original path. Apparently, nobody does! There should be a trash history file somewhere identifying files in trash named or prefixed by ascending unique number but maybe with any extension intact.

file original location +ubuntu trash - Google Search
# 5  
Old 10-27-2010
My problem is NOT the trash location etc. I've found them. My single problem is to take a file's locationSmilie
# 6  
Old 10-27-2010
Yes, the original location before being trashed is an unknown. I can find a no-sym-links path with realpath(), but I do not thank that is what you are up to. You are talking about a file manager with a trash can but not enough foresight to save where they were trashed from. That data has gone to what we used to call 'the bit bucket', where the bits go when you shift them out, not end around. The community is not happy, and you can go vote to have it fixed. It's slow, like the Obama Change and the Recovery.
# 7  
Old 10-27-2010
Question

Oh, come on, little talking, much work! :P

Deleted to trash files go to:
$HOME/.local/share/Trash/files

Their info files (which includes deletion time and the path from which had been deleted) go to:
$HOME/.local/share/Trash/info

What I need is simple, I need a command that outputs the path of a specified file so to echo it at the deleted file's info file so the Trash can restore it if needed, is it so hard, really? :PSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

2. Shell Programming and Scripting

Moving files from parent path to multiple child path using bash in efficient way

Hi All, Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created. /Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt /Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Discussion started by: karthikgv417
6 Replies

3. Shell Programming and Scripting

make file (include files path)

Hi All, In make file i want to include header files from my local directory and if it did not find in local directory i want to include from network directory. can any help me how i can do this?. here is the code INCLUDE=${include}/ this is point to network dir how i can add option that it... (1 Reply)
Discussion started by: goraya430
1 Replies

4. Shell Programming and Scripting

unzip few files but with same path and file name.

Hi Everyone, For exmaple, i have 5 .zip files. So i can do "unzip -L -o file1.zip -d /home/user1" for every 5 files. But the problem is those 5 zip files, have same path and file name. So if i use "-o", all will be overwirte. The output is unzip all files, but put all unzipped files... (1 Reply)
Discussion started by: jimmy_y
1 Replies

5. Shell Programming and Scripting

command to list files with path & date in a folder

Hi, I need command to display files with full path and date of files where are generated at every 5hrs in a folder. eg: /u01/app/test/orjthsd_1_1 Sun May 10 19:03:26 2009 /u01/app/test/weoiusd_1_1 Sun May 10 21:00:26 2009 thanks saha (3 Replies)
Discussion started by: saha
3 Replies

6. Red Hat

ls command to give full path to files

How can i perform a ls or other command to list the full paths of files from a ls? Looked through the man page for ls, no luck $ cd /tmp/ $ ls -l total 6 drwx------ 2 root root 4096 Nov 7 2008 keyring-7b5rMv drwx------ 2 bcr bcr 4096 Dec 7 2007 keyring-cGhir8 $ I'd be looking for... (1 Reply)
Discussion started by: brendan76
1 Replies

7. UNIX for Dummies Questions & Answers

find locked files, print file path, unlock file

using OS X and the Terminal, I'd like to find all locked files in a specified directory, unlock them, and print a list of those files that were unlocked how can I do this? I'm familiar with chflags nouchg for unlocking one file but not familiar with unix enough to do what I'd like. Thanks! (0 Replies)
Discussion started by: alternapop
0 Replies

8. UNIX for Dummies Questions & Answers

command to find the path of a file

What is the command to find the path of a file if we know the file name and the root directory where the file resides.. For eg. if a file abc.dat resides in /home/mydir/myfiles/. I am looking for a command which will be fired from / directory, takes abc.dat as input and display the path of... (3 Replies)
Discussion started by: abhilashnair
3 Replies

9. UNIX for Advanced & Expert Users

list all files with full path of the file

How can i list every single file on a sun solaris server running 2.8 starting from '/' with the full path included in it? example. / ... ... ... /etc/inetd.conf /etc/passwd /etc/shadow ... ... ... /var/adm/messages /var/adm/messages.0 /var/adm/messages.1 ... ... ...... (4 Replies)
Discussion started by: Sowser
4 Replies

10. Shell Programming and Scripting

How would I make a find command NOT show the path of a file?

When I do find . -name "*.txt" -size +0 -exec ls {} \; I get something like ./lpi_stdout.txt ./lpi_stderr.txt What would I need to do or pipe it into to strip off those first two characters so I just get lpi_stdout.txt lpi_stderr.txt ? Thanks for the help! (1 Reply)
Discussion started by: LordJezo
1 Replies
Login or Register to Ask a Question