General :: Given A File Path Search For File Exist?
Jan 27, 2011I have file which consists of many files with their path,i need to check for the file exists in the given path,how to check?
View 12 RepliesI have file which consists of many files with their path,i need to check for the file exists in the given path,how to check?
View 12 RepliesI use this command:
Code:
find ./ -atime +360
to figure out the files that haven't been accessed since 360 days. The command above will return results like this:
Code:
/uploads/2010/02/some-file-name.ext
/uploads/2009/08/another-file-name.ext
... etc
I'm taking here about tins of directories, thousands of files. I'm looking to find a command that makes me able to move the results above to another path, and to create that path once it doesn't exist like below:
Code:
mv /uploads/2010/02/some-file-name.ext /old-files/uploads/2010/02/some-file-name.ext
But I want the executed command to create this path
Code:
/old-files/uploads/2010/02/
If it doesn't exist.
This should be simple but I can't seem to find what I am looking for.I want to search a text file for the existence of certain strings and execute a command if they exist, something along the lines of:
if <string> exists
command
or
if <any member of this list exists>
command
I know how to manually search a file with grep, cat, etc., but the "if this exists" part eludes me.
I had a situation in which the the path of the file to be copied is written in other file and I had to copy it using shell script..I can use cp $(cat /home/robert/location.txt) /media/sda1 on normal linux shell...But I am using buildroot script where $(cat /home/robert/location.txt) evaluate to nothing..is just blank..
View 1 Replies View Relatedfor example we search a file for a certain keyword..is there any application available which will enable us to search for a single keyword in all the files within the folder ?i want to search for a keyword in about 1000 files..if i do it manually it will take loads of time..
View 6 Replies View RelatedDoes executable file contains the precise path to SO file? Should it be compiled with precise knowing of SO file location?
View 8 Replies View RelatedI want to create a logon script (or somesuch) that creates a file (if it doesn't already exist) and checks the file for some info otherwise. If it finds a given trigger in that file, it logs into a local database and does some operations.
Now my problem isn't with creating that file or even getting it to function as a logon script -- it's with permissions. After the logon script creates the file, I want that user to have read access on it ONLY. Further, I don't want to give the user any kind of root access so that they could do the database operations in question or chown/chmod the file.
What's the best practice here? I'm noticing that whenever the script runs (in .bashrc right now) the script runs with the current user's permissions. Ideally, I'd like to make it so the login script can run at a higher level of permissions, (higher than the user has). Is this even possible? What's the best way to do this?
when I reviewed the error_log I found that it is logging thousands of errors which are similar. I've included a sample of the errors. The following error seems to happen constantly, from many different ip's...
Code:
[Thu Apr 22 01:02:06 2010] [error] [client (the ip address removed)]
File does not exist: /home/virtual/site4/fst/var/www/html/colombia-news,
I had installed BIND packages but /etc/named.conf file is missing as the packages are shown,
[root@nisserver ~]# yum list bind*
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
[code]...
I want to install kindle in kubuntu. I seem to have successfully installed wine and and added ms explorer.exe. but when I click on Browse C drive...
Unable to run the command specified. The file or folder file:////Documents/.wine/dosdevices/c: does not exist.
I have asked this over on Launchpad and have found bugs filed on the eclipse bug tracker but it seems to be going nowhere so I guess ill ask here.
I am using Eclipse for some development work and having saved a file, defocus the eclipse window (to test changes in a browser) when I refocus the eclipse window I get the following error...
The file 'path omyfile' has been changed on the file system.Do you want to replace the editor contents with these changes?
I have searched and searched and this seems to be a CIFS/SAMBA problem. I even found one solution suggesting that changing his mounts from cifs to smbfs fixed his problem however that would appear not to be an option for me since using smbfs in the fstab causes cifs mounts. This problem would seem to occur in Bluefish as well as some other IDE's so it is not an Eclipse issue.
---------- LINKS TO RELATED ----------
Launchpad Question
Eclipse Bug
--------------------------------------
I have just installed SABnzb application in my home folder. The executable file is SABnzb.py When I run the command in the Konsole # python SABnzb.py I have this Quote: python: can't open file 'SABnzbd.py': [Errno 2] No such file or directory
View 5 Replies View RelatedSo I want to run command through ssh but also run a if check in bash to see ifa file exist. I know that to run ssh commands you do ssh user@server YOURCOMMANDbut if i need to run an if statements, how would this work??
View 4 Replies View RelatedHow to find filename and file path from a string
View 7 Replies View RelatedTried running simdock from software center...uninstalled because I was getting this error after trying to run ap "Can't load image from file '/usr/share/firefox/icons/mozicon128.png': file does not exist."
View 3 Replies View Related1. i want to make backup database(use mysqldump)
2. copy from server(use linux-server) to client PC (use linux- ubuntu 9.0)..
3. before that i want to search that DB file using terminal..
4. bcoz i dont know where the files are located
I have a doubt, i have a file which contains around 3000 elements, now i want to search for an element in that file.what will be the Efficient way of searching ? without consuming much memory and time..
1) is this efficient if i take all the 3000 elements from file to a list or array and sort them and search ?
2) or is it efficient to search directly inside the file ??
Can anyone please suggest some algorithms for an efficient way to search in this case ?I am using C for coding..
I can do:mkdir messages and then: touch messages/hello.txt Is there a command that will do both - create the directory if it doesn't exist, and then the empty file? Something like: touch -p messages/hello.txt
View 1 Replies View RelatedI downloaded a program called tonespace http://www.mucoder.net/en/tonespace/ which I extracted and then tried to execute the executable file with ./tonespace. This gives me the following message:
bash: ./tonespace: No such file or directory
When I use the command: file ./tonespace I get this: tonespace: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
I dont get it. The file is clearly there, yet when trying to execute it bash doesn't seem to recognize it.
It has permissions rwxr-xr-x and is not owned by root. Am I overlooking something?
I am trying to load a driver (xxx.ko) and uncertain if the path given is correct.
I do not have any direct access to my linux device, so I need a small script that will create a text file telling me if the file was found or not.
I am searching for Class declaration on a site with hundreds of PHP files, how can I do this in the current folder and subfolders using GREP?
I tested cding to the folder and then something like
grep -r 'class MyClass' *.php
total newb here. call me a script kiddie if you want but here is what i need to do and what i have.
need to:search a hidden log file for a specific string, find what comes after that part, and then output the result to a variable or something that can be used by an application or other script to carry out further actions.
The requirement was to write a shell script for a cron job set for every two hours for all days.The Script has to scan log files (*.log) for the logs posted only for the last two hours.... and append them in a new file...I am clueless abt how to scan/compare based on time stamp seen in above logs.
View 2 Replies View RelatedI used locate cmd to search file abc.txt (for example) as I didn't know in which directory it would be present and couldn't find it. But when I did find . -name abc.txt, it traced the file, luckily the file was in the same directory. I am wondering how find was able to search abc.txt and locate not. How these two are behavinb differently? Usually I use locate when I don't know the path to the parent dir.
View 8 Replies View RelatedI want to search in my apache log, for events which have occurred say between 11:00 AM to 2:00 PM. I have got few scripts/commands but they are not conclusive, some of then are trying to do an exact match(awk) and for some i am just getting the pattern wrong (eGrep)
I am running RHEL.
Apache log eg:
================================================================
10.92.120.129 - - [24/Jun/2011:01:29:07 -0500] "GET /favicon.ico HTTP/1.1" 302
================================================================
now if i want to find out the logs from 1 PM to 2 PM
some example i had was:
cat <apache.log> | grep -E '07/Apr/20110[1-2]:[0-5][0-9]|02:00)'
small script in which i can pass the start time and end time range, and it should give an output of the rows which fall under that time range.
i can download but i cant run anything because there is no ar file path for ark. please dont tell me to download something to get the ar file path because if i download it i can't open it
View 1 Replies View RelatedUsually in Gnome, under Ubuntu, the terminal command I use is:
Code:
gnome-open (path)
In most cases, I won't know the path and I'd rather not search for it with:
Code:
locate (file name)
what is the file and path name of the configuration file to which you would add to the AllowUsers charlie linus lucy?
View 3 Replies View RelatedKernel 2.6.21.5, slackware 12.0 For a given app run by me as user john to be able to create a file in /foo1/foo2/, what do I need? (a) john to have write permissions in /foo1/? (b) john to have write permissions in /foo1/foo2/? (c) john to have write permissions in both /foo1/ and /foo1/foo2/? Any hint will be welcome. Note: No. It's not homework. KTorrent complains when trying to create the files being downloaded, saying 'permission denied'. But I think he is being run by another user. I can explain in a different thread.
View 3 Replies View RelatedI want to assign the path of a sourced sub.bashrc file to an environment variable. E.g. if I type (or execute) from a known relative location
$ source ../../someDir/sub.bashrc
the sub.bashrc should set a variable like
export MyOwnLocation=/home/user1/unknownlocation/someDir
The problem is I can't use $0 as reference because the script is only sourced not executed. I also don't want to hardcode the path because the location might change and there will be more copies. Is there an easy way to create this information from within the the sourced bashrc file? I use Gnu bash 2.05b on Suse Linux 9.