HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   Sudden Problem Started using cp: command "omitting directory" (http://www.howtoforge.com/forums/showthread.php?t=8165)

bpmee 13th November 2006 22:43

Sudden Problem Started using cp: command "omitting directory"
 
Hi All,

Thanks in advance to anyone that can help me with this one...:)

Just today, I'm having problems using the cp: command:

1. Suddenly, -i (interactive) is forced upon me, even if I didn't call for it.

2. If I use " -f ", I get an interactive prompt.

3. I get directory not found, or "directory omitted" for the following commands, that * worked fine * up until today:

Code:

find /var/www/web1*/web/bmres*/myfolder/ -maxdepth 1 -type d | awk '{print "cp -f -R /home/searchfeed.php "$1"/"}' | /bin/sh
makes error

Code:


: No such file or directory: line 12: /bin/sh

OR, if I call it simply from the shell, as in the following:

Code:


cp -f /home/searchfeed.php /var/www/web1*/web/site*/myfolder

makes errors:

Code:


cp: omitting directory `/var/www/web199/web/site_source_aaaadn0/myfolder'

for EVERY web folder and site_source folder within the web1* call!

What's up, these commands worked fine a few days ago!

:confused:

falko 14th November 2006 15:34

Quote:

Originally Posted by bpmee
OR, if I call it simply from the shell, as in the following:

Code:


cp -f /home/searchfeed.php /var/www/web1*/web/site*/myfolder


You are using wildcards for the target directory. Are you sure you want this?

Quote:

: No such file or directory: line 12: /bin/sh
In which script do you get this?

bpmee 14th November 2006 15:48

I get that error in the first script with I listed containing the "awk" command
 
Hi Falko,

Thanks for your reply.

I get that error in the first script I mentioned, the one containing the "awk" command...

I want to use wildcards because I have many folders and divided into various sections throughout each "web1*" designation....

I'm not sure why this is suddenly happening - I had no troubles before yesterday!

falko 15th November 2006 15:46

Quote:

Originally Posted by bpmee
I get that error in the first script I mentioned, the one containing the "awk" command...

Please post the contents of that script here.

bpmee 15th November 2006 22:54

Here's the code bit
 
Hi Falko,

Here's the code.... note, I use various iterations of it, such as web2*, web3*, etc because of the extreme amount of folders and sites on my server...

Code:

find /var/www/web1*/web/site*/myfolder/ -maxdepth 1 -type d | awk '{print "cp -f -R /home/searchfeed.php "$1"/"}' | /bin/sh
echo bm1

* Note, the double wild card is on purpose....

THANKS!:cool:

falko 16th November 2006 16:10

Why do you pipe the output of the command through /bin/sh? :confused:

bpmee 16th November 2006 17:08

I borrowed this code piece from another script I saw
 
Hi Falko,

I found this code originally from another shell script on the web.

I just tried running it without the | /bin/sh and the shell showed the cp command, but nothing was actually copied...

The output was like the following:

Code:

cp -f /home/searchfeed.php /var/www/web35/web/site_source_aaaafa4/myfolder
Despite this output the file was not copied! Note, I'm trying to overwrite an existing file with a new version - perhaps I need to provide a command to remove this old file first?

I'm hesitant to do this only because I don't want to accidentally erase other files......:confused:

falko 17th November 2006 14:58

Can you post your full script here, not just an excerpt?

bpmee 20th November 2006 16:59

Here's the code
 
Hi Falko,

This is the full code:

Code:

##
##
find /var/www/web0*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm0
find /var/www/web1*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm1
find /var/www/web2*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm2
find /var/www/web3*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm3
find /var/www/web4*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm4
find /var/www/web5*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm5
find /var/www/web6*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm6
find /var/www/web7*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm7
find /var/www/web8*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm8
find /var/www/web9*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm9
##
##
##
find /var/www/web0*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site0
find /var/www/web1*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site1
find /var/www/web2*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site2
find /var/www/web3*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site3
find /var/www/web4*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site4
find /var/www/web5*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site5
find /var/www/web6*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site6
find /var/www/web7*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site7
find /var/www/web8*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site8
find /var/www/web9*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site9
##
##


falko 21st November 2006 15:27

Please put
Code:

#!/bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin

right at the beginning of the script.


All times are GMT +2. The time now is 16:22.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.