how to check two arguments whether it is a file and the other is a directory, check if files exist in directory and copy it if it is a newer version. Seriously i need idea to do tis, jst some simple sample wil do
i tried to create a if else statements or either an else statement I get a message saying that the directory exists (mkdir: cannot create directory `./MAY2010': File exists I am running this in a crontab file and I dont want any output telling me that the directory exists. I just want to check if the directory doesnt exist, create one else do nothing (not even a message telling me that the directory exists).
How would i go about copying files to a directory, yet skip the files that already exist in the directory, and also remove the files that are in the directory. For example:
Code:
$ls /dir1 img001.jpg img002.jpg
[code]....
Now i would like to copy from dir1 to dir2, but the contents of dir2 would be:
I think as a result of a script that started duplicating files in a loop, the allotted capacity on my VPS filled up with multiple nested copies of the same files... After a reboot, I could delete most of them, but got rm stalled in certain directories...
after isolating which ones, I found this: a directory listing that lists the files, and at the same time tells me they are not there!!!
partial listing:
Code: ls ls: cannot access userkey.php: No such file or directory ls: cannot access workshop.php: No such file or directory ls: cannot access quiz.php: No such file or directory ls: cannot access webservice_rest.php: No such file or directory
new to ubuntu and linux, and using Lucid 10.04 LTS ok, i'm trying to get XBMC going, and following a nice step by step instruction on wiki.xbmc.org, but now i'm stuck at this step... In Ubuntu the SVN Repositories are not automatically added. You must add them manually. First, download the SVN Repo Installer from: [URL] Extract it to the ~/.xbmc/plugins/programs directory. If this directory does not exist, run XBMC one time and then exit back to Ubuntu. The directory should now exist.
i ran xbmc once (after the video driver problem was solved, though it messed up my dual monitors, gotta figure that one out yet.) i got the zip file, it's in my downloads. now my newbness really shows... i can't find an 'extract' command for gnome, can't find the .xbmc directory using the file browser, can't figure out how to hunt for folders instead of files, and don't know how to look inside folders i don't have permission to, that is, i don't know if there's a 'sudo' like option for the file browser. i've been searching the forums, but without the correct search terms, i'm wading in an ocean. i really want to give ubuntu an honest try, but i feel like a foreigner. EDIT: btw, up to this point, the forums have been invaluable, you all are great.
I wanted to write a script which would check the hash-sums of all files within a certain directory and compare them with previous hashes. I remembered that rkhunter does this by default for certain files. So my idea was to use rkhunter for this task. I copied the default configuration file and made some modifications to it. However, I just cannot get it to work. It always just computes the hashes for files in /bin /usr/bin etc. But I would like to also check the files, e.g. in /boot. Is there any way to configure rkhunter to compute and store hashes for *normal* (i.e. non-executable) files?
i have CentOS 5.2 based server running openssh, which gives sftp service to the outside users(from internet), the users from some public ip-addresses uploads and download files from sftp-server directories. I want that whenever a user uploads a new file in certain directory of server, the server should send me an email alert
I have backup_server and application_server.backup_server has directory AAA. I need to check from application serverthat is there any new files created today in the AAA dirctory. if yes, all files were created today or partial files?.
I need to find if, in a folder any directories exist, except a certain one named "mes croquis".What I am trying to say, is that the re already is a directory named "my croquis", which I have to ignore. IF any other directory appears, I have to archive them.I got everything so far, except the starting condition.In other terms , I am lookign for something like this:
IF anyDir EXIST AND name != "mes croquis" do something else
I have a macro which I use with ROOT. In this macro I want to check if a part of string exist so I can ignore it inside a loop. So, inside a loop I want to have something like:
Code: if (string == "pre_ti_data_bdt*" || string == "pre_ti_data_nn*") continue;
but of course I cannot use * in this piece of code! How to do this trick in C++?
So 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??
I'm building a RPM package. In my SPEC file, in the "%pre" and "%post" sections, I need to be sure that Postgresql-server is started.I tried to add a "PreReq: /var/run/postmaster*" but the * is not interpreted ! (filename changes, depending on the linux distribution)Is this way test that this file exist (or test if the result of "pidof -s/usr/bin/postmaster" is empty, for example
My desktop just froze for some reason and I had to force shut down. When I logged back in I could not get into my /home/username directory, a message popped up that it does not appear to exist and if I would like to put it as root.
Have Apache running on Ubuntu Server. Say I have a domain, www.somewhere.com, and I have uploaded a file, phpinfo.php. If I hit http://www.somewhere.com/phpinfo.php, I get my file as expected. However, If I hit non-existent file http://www.somewhere.com/phpinfo/somefile.dat, it also acts as if I hit phpinfo.php, instead of giving me a 404 error. It seems that because the DIRECTORY "phpinfo" does not exist, it decided that I must have meant to hit phpinfo.php at the root of the site.
If I create an empty "phpinfo" directory then it behaves as expected and gives me a 404 not found page. This is reproducible for any other file name you can think of. I'm sure this is some Apache convenience behavior but I would like to disable it (it is messing with some mod_rewrite stuff I would like to do). Because it's hard to describe I cannot figure out which Apache option it might be (whatever I Google for gives me completely unrelated results).
I just recently bought a second hand netbook (HP Mini Mi 110) from ebay which use linux ubuntu as OS. I changed the previous username to mine but when i tried to login again...this warning pop out "your home directory is listed as: '/home/mazlin' but it does not appear to exist. Do you want to log in with the /(root) directory as you home directory? It is unlikely anything will work unless you use a failsafe session" so i click yes. then...
user's $HOME/.drmc file is being ignored. This prevents the default session and language from being saved. File should be owned by user and have 644 permissions. user's $HOME directory must be owned by user and not writable by other users. next i click OK, then... your session only lasted less than 10 seconds. if you have not logged out yourself, this could mean that there is some installation problem or that you may be out of diskspace. try logging in with one of the failsafe sessions to see if you can fix this problem. when i click ok, the login screen reappear again... how to use failsafe sessions.
I want to copy a file from an old directory to a new directory and ideally I would like that the 'mv' command itself could create the directory for me in one step...That is to say that the directory would not exist until 'mv' has been called as in:Code:mv olddirectory/file.dat newdirectory/file.datso mv would create the directory 'newdirectory' in the above call....I am not sure if this is possible however, that is to say I think it may be necessary that the directory 'newdirectory' already exists before I make the above call to mv, as when I make try the above call when 'newdirectory' doesn't exist I get the following error:Quote:mv: cannot move `test1/4215/4215-001R.fit' to `test2/test.fit': No such file or directoryso to sum up, my question is:is there some paramater for 'mv' that I can change so that it will create the new directory as well as copy the file and if not, are there other commands that might do this?
On a KDE4 environment after downloading some music from rapidshare with JDownloader the archives self-extracted with the symbol in some of the file names. Those files couldn't be renamed or deleted, the file manager said that the files didn't exist - very weird. The files should have had some swedish characters in their file names. Now I'm stuck with those files on my machine. Anyone knows how to get rid of them?
Is it possible to have Archive Manager create the specified folder when I enter it into the path field? Like if I want to put something in "/Main/Sub1/Sub2" But "sub2" doesn't exist, can I just have Archive Manager create it and put the files there?
I am running a fairly new Debain Jessie stable installation with Xfce desktop. I need to use Xfce4 becuas the standard Gnome 3 does ot work when logging in with xrdp which I use becuase the actual box is headless.
I have an issue when starting synaptic. When I start it from the menu entry it just does not start. When I start from the terminal with
Code: Select allgksudo synaptic
I get an error box "Unable to copy the user's Xauthorization file" At the same time I can see in the terminal window a message
"Error copying '/home/userxxx/.Xauthority' to /'tmp/libgksu-SwcIe0': File or Directory not found".
I assume it is related to that I use a rdp session to connect, but I am otherwise clueless.
Code: Select alluserxxx@server2>xauth xauth: file /home/userxxx/.Xauthority does not exist
I need to compile "/usr/share/zoneinfo/" to a directory in /home/dir/ so I can use it in a program to find and assign a time zone to users (example: UTC +3 or similar) and I need all available cities and town in it. it seems I should be able to do that with "zic" but what I found and tried does not work. I needed examples and I found the only info giving examples comes from: [URL]... Trying the 2 first lines verbatim after creating the "test-tz" directory gives an error that was to be expected although I use the distro used in the example, this is because the directory "australasia" does not exist but directory "Australia" does.
[code]...
I should be able to extract the info mentioned above is correct?
There are millions of files in many directories. Wherenver i try rm * or find or use xargs, they say 'argument list too long' and exit. How can i deleted files in a directory with so many files without deleting the directory itself.
I recently have been trying out the Ubuntu live CD.
I have a shared computer where some are suspicious of anything other than Windows. The live CD is an excellent way forward.
As I understand it Ubuntu is loaded into the computer RAM, thereby it makes no actual changes to the computer as it does not load into the hard drive.
I have noticed that if I have been doing work on the computer and forgotten to empty the trash, when I run the live CD on another occasion this material is still in the trash.
Is data put into the trash saved to the hard drive?
It does not matter to me if it is as long as I have deleted it but I would like to know where it goes if it does save to the hard drive.
I'm using a dual boot system with kubuntu 10.10 and windows vista.When I try to copy files from kubuntu to a windows drive, I see no problem.But when I retsart to windows usually I can't see my files. Once or twice I have seen files I copied in kubuntu. The strange thing is that when I go to kubuntu again, I don't see files I have copied in windows drive.
I was using the following command to search for tmp files older than 15 days for deletionI used "ls -l" first just in case
Code: find somedirectory/ -type f -ctime +15 -exec ls -l {} ; then i noticed that occasionally i get a "No such file or directory" error
When I looked at the directory, the file was not there.How does "find" find a file that doesn't exist?Is it possible that the file can be deleted right at the moment after a file is found and before the command executed?
I no longer have access to my root desktop. On a session I attempted to change the root username but i apparently assigned it a wrong directory that does not exist. When I rebooted with my new root username, i was instead recognised as a simple user (no root privileges). I tried the console to change to "old" root but root password is not accepted and there is no way to access to sudoer files. it seems that inserting a new username requires root privileges and i am back to square one. Simply logging with old root username and password after restart gives me a blank screen with nothing on it and cannot even reboot.