I have a folder on my server named 'EVENTS' and it contains an additional 50 folders 'EVENT1', 'EVENT2', 'EVENTS3' etc, etc. Each of these 50 folders contains within them a varying amount of files and folders also. (So that is the set up).
I am wondering if it is within the capabilities of a script to zip all folders in the 'EVENTS' folder recursively ('EVENT1', EVENT2 etc) which would of course include all of the folders contained inside the 50 that live in 'EVENTS' folders. Kind of drilling through all folders contained within the 'EVENTS' folder without having to name them all in the script as they will be changing over time.
If this could be done (I would need a cron to run it once a day) I would need the old zip to be deleted by the new daily zip.
At all times I would have the folder structure mentioned above in place with a zipped version of every folder next to the actual folder it was a zipped version of.

So if I was speaking to the script I would say " I want you to go into every folder you find inside the 'events' folder and zip it, but you must leave the original folders that you have zipped in place and drop the zipped version of next to it, I want you then to do this every day and remove the old zip with the new one, I don't have a list of all the folders in the 'EVENTS' folder, so go into it and work your way through".

How weird is this getting, I am not the best at explaining but I think this is a little more clear.

Many thanks again for your help

Hey There,

I am not sure what you want, exactly ;) Let me know if this is close: look through the entire events folder, find all the events subfolders and then gzip everything in those folders and place each gzipped file from each folder next to the corresponding subfolder in events/events1, etc
? Am I close ;)

What do you have so far?

For doing the above you could run find once to scour the events folder with files with the -name "events*" value and then pipe that to another find to list everything in the subdirectory (one by one) and gzip them all and move them up.

After you ran that, you could (assuming all is equal) do an file check operation (if [ -e FILENAME ]) to determine if an older version of your gzip exists and delete that before you move the new gzip up.

Sorry if this is haphazard or more confusing than helpful. We're both in the same boat ;)

If you could post more technical specs and/or what you have already and what's not working, I could probably help you out with this more specifically :)

Best wishes,

Mike

First of all many thanks for your reply.
Yes you are close.
I will attempt to give you the full picture.
I have a php script running on a dedicated server (Securloads is the script).
It is a really good script, ideal for what I am trying to achieve, it allows me to give access to clients to download via a browser any combination of files and folders that I allocate them permissions for, the access is username and password protected.
If I give you access to 'Folder1', and 'Folder2' inside The 'EVENTS FOLDER thus all its contents within 'Folder1' and 'Folder2', all I do at the back end is allocate you the permission to do so, then you will have access to download only those folders and what they contain, despite the fact that there may be many other folders in the 'EVENTS' folder, when you log in 'Folder1 and Folder2 are all you will see. How the script goes about downloading individual files inside those folders is clean and simple, you check/tick the file you require (checkbox at the side of every file) and at the otherside of the name of every file/s there is also a button for you to download - my problem is that when I require a folder to be downloaded s opposed to a file, when the folder has been selected and the download button is pressed the contents of that folder are then zipped before downloading and then are downloaded in one zip file, unfortunately this only works if there are only a few files in the folder being zipped to be downloaded, any folder with a large number of files to be zipped and downloaded fails, it can't seem to handle having to zip a lot of files within one folder, what I am trying to achieve via a shell script is every folder within the EVENTS folder needs to be zipped (there will be something like 50 folders in the EVENTS folder each one containing its own folders and files) and for the zipped folders to remain in place next to the folder it represents, this way anyone needing to download a full folder of files will have the chance to download the already zipped version next to it, as 'SECURELOADS' can't handle zipping the full folder full of lots of files. And as these files and folders within the events folder are changing regularly I didn't want to have to name the folders in the shell script that will do the zipping.
I have a shellscript at the moment that will zip a selected folder and zip it, and will remove the older zipped folder with the new one (see below) this is run every 24 hrs via a cron, so if the contents of the folder it is zipping has had any changes it will be reflected in the new zipped version as the new one removes the old one.
Problem with this is I have to name all the folders inside 'EVENTS'. I would like it to deal with all folders inside EVENTS however many and whatever name without me having to individually name the folders requiring to be zipped in the script.
"I want you to go into every folder you find inside the 'events' folder and zip them"
Below is the script I have for zipping an individual folder named big_picture and locating it to a different location, in a folder named 'zipped'.
I have replaced some of the path with asterix's for safety on the forum.

#!/bin/bash

# dirs to backups
DIRS="/domains/•/•/••••••••••••••••••••••.com/public_html/storage/events/big_picture"

# Save zip file elsewhere on the server 
DEST="/domains/•/•/••••••••••••••••••••••.com/public_html/storage/zipped/big_picture_zipped"



# set to "no" keep old zip file and add new file
DELETE_OLD_ZIP_FILES="yes" 

#Path to binary files
BASENAME=/usr/bin/basename 
ZIP=/usr/bin/zip

for d in $DIRS
do
    zipfile="${DEST}/$(${BASENAME} ${d}).zip"
    echo -n "Creating $zipfile..."
    if [ "$DELETE_OLD_ZIP_FILES" == "yes" ]
    then
        [ -f $zipfile ] && /bin/rm -f $zipfile 
    fi
    # create zip file
    ${ZIP} -r $zipfile $d &>/dev/null && echo "Done!"
done

I hope this makes it clearer and not turned it to mud.

Hey There,

I think I get what you're going for. You could use this inside your script to do what you want, I believe:

find /path/to/events -name "events*"|while read x
do
   zip -r ${x}.zip.tmp ${x}
   if [ ! -e  ${x}.zip ]
   then
       mv ${x}.zip.tmp ${x}.zip
   fi
done

Please let me know if that's too simplified and you're looking to do more. Just substitute /path/to/events with the full patch to your events directory and change "events*" if any of the letters are capatilized, etc.

I hope I've been of some help. If not, write back and let me know where I misunderstood and I'll give it another shot :)

Best wishes,

Mike

Hi thanks again
Where would you recommend that I insert your suggested code?
Should it be replacing any of the existing code I have in place?

Hey There,

You can work it in where you like, since you setup a lot of variables, but generally, I suppose, you could use the code

find /path/to/events -name "events*"|while read x
do
zip -r ${x}.zip.tmp ${x}
if [ ! -e ${x}.zip ]
then
mv ${x}.zip.tmp ${x}.zip
fi
done

right around this part

for d in $DIRS
do
zipfile="${DEST}/$(${BASENAME} ${d}).zip"
echo -n "Creating $zipfile..."
if [ "$DELETE_OLD_ZIP_FILES" == "yes" ]
then
[ -f $zipfile ] && /bin/rm -f $zipfile
fi
# create zip file
${ZIP} -r $zipfile $d &>/dev/null && echo "Done!"
done

and remove some of the variables (unless you want to keep them) like DIRS, since you'll be getting them with the "find" command :)

Best wishesl

Mike

Hi Mike

Is there any chance of you putting the whole script together and putting comments through the script explaining what parts do what - I am very keen to learn but am still at a very early stage - I do realise that this is taking your time and can only repeat a big thank you for all the help you have given me so far - is there a book you could recommend for learning shell scripting (basic), hope you are not offended by my requests.

Many thanks

/domains/*/*/*************.com/public_html/storage/events

above is the path to events - I will fill in the asterix's

Hey,

No problem, glad to help out anyone who's willing to give it a shot and gets stuck. Happens to all of us :)

Here's a rewrite of that script (I didn't fully test the way it will work with the delete-old-zip-files set to "no," but it should work)

Here's the script, with comments and, below that, I put a cut-and-paste of my term output of two runs, showing that the zipfiles get replaced. Of course, I used my own simpler directory structure, but that's fixed as simply as changing the EVENTDIR variable :)

Best wishes,

Mike

#!/bin/bash

# Top level directory to look for event* sub-folders
EVENTDIR="/domains/*/*/*************.com/public_html/storage/events/"

# Set to "no" keep old zip file and add new file
DELETE_OLD_ZIP_FILES="yes"

# Path to zip executable
ZIP=/usr/bin/zip

# Unique $TMP extension for newly created zip files
# Temp extensions made up of PID of running process and
# date.  Ex from 1/11/09 with PID 23454: 01110923454
PID=$$
DATE=`date +%m%d%y`
TMP=${DATE}${PID}

# Find all events subdirs in main events dir - events1, events2, etc
# -name = events[0-9]* rather than events* to make sure the main events folder doesn't get added
find $EVENTDIR -type d -name "events[0-9]*"|while read x
do
        # Then create a zip with contents of each and the name of the
        # events folder with tmp extension appended.  Ex: events1.zip.01109.23454
        zip -r ${x}.zip.${TMP} ${x}
        if [ $DELETE_OLD_ZIP_FILES == "yes" ]
        then
                # If our variable says to delete old zip files, move the temporary
                # zip file to the straight name - e.g. events1.zip
                mv ${x}.zip.${TMP} ${x}.zip
                # Then, just to be sure, remove all possible temporary zip files
                # left over from previous saves
                rm -f ${x}.zip.*
        else
                # If our variable says to NOT delete the old zip files,
                # if the zip file exists...
                if [ -e  ${x}.zip ]
                then
                        # swap the new temp zip file with the basic zip file
                        # name - e.g. events1.zip.011109.23454 <-> events1.zip
                        # First: move existing plain zip to uniquely named zip.bak file
                        mv ${x}.zip ${x}.zip.bak.${TMP}
                        # Next: Move our temp zip file to the plain zip file name
                        mv ${x}.zip.${TMP} ${x}.zip
                        # Then: Move the uniquely named zip.bak file to our temp zip name
                        mv ${x}.zip.bak.${TMP} ${x}.zip.${TMP}
                else
                        # if no zip file exists, just move the temp zip name to the real one
                        mv ${x}.zip.${TMP}
                fi
        fi
done

Script run output with long output from find to show differences:

$ find events/ -exec ls -ld {} \;|awk '{print $5,$6,$7,$8,$9}'
4096 Jan 11 21:02 events/
0 Jan 11 20:44 events/events1
0 Jan 11 20:44 events/events1/a
0 Jan 11 20:44 events/events1/b
0 Jan 11 20:44 events/events2
0 Jan 11 20:44 events/events2/a
0 Jan 11 20:44 events/events2/b
0 Jan 11 20:57 events/events23
0 Jan 11 20:57 events/events23/a
0 Jan 11 20:57 events/events23/b

$ ./eventdir
adding: events/events1/ (stored 0%)
adding: events/events1/a (stored 0%)
adding: events/events1/b (stored 0%)
adding: events/events2/ (stored 0%)
adding: events/events2/a (stored 0%)
adding: events/events2/b (stored 0%)
adding: events/events23/ (stored 0%)
adding: events/events23/a (stored 0%)
adding: events/events23/b (stored 0%)

$ find events/ -exec ls -ld {} \;|awk '{print $5,$6,$7,$8,$9}'
4096 Jan 11 21:02 events/
0 Jan 11 20:44 events/events1
0 Jan 11 20:44 events/events1/a
0 Jan 11 20:44 events/events1/b
446 Jan 11 21:02 events/events1.zip
0 Jan 11 20:44 events/events2
0 Jan 11 20:44 events/events2/a
0 Jan 11 20:44 events/events2/b
446 Jan 11 21:02 events/events2.zip
0 Jan 11 20:57 events/events23
0 Jan 11 20:57 events/events23/a
0 Jan 11 20:57 events/events23/b
452 Jan 11 21:02 events/events23.zip

$ ./eventdir
adding: events/events1/ (stored 0%)
adding: events/events1/a (stored 0%)
adding: events/events1/b (stored 0%)
adding: events/events2/ (stored 0%)
adding: events/events2/a (stored 0%)
adding: events/events2/b (stored 0%)
adding: events/events23/ (stored 0%)
adding: events/events23/a (stored 0%)
adding: events/events23/b (stored 0%)

$ find events/ -exec ls -ld {} \;|awk '{print $5,$6,$7,$8,$9}'
4096 Jan 11 21:04 events/
0 Jan 11 20:44 events/events1
0 Jan 11 20:44 events/events1/a
0 Jan 11 20:44 events/events1/b
446 Jan 11 21:04 events/events1.zip
0 Jan 11 20:44 events/events2
0 Jan 11 20:44 events/events2/a
0 Jan 11 20:44 events/events2/b
446 Jan 11 21:04 events/events2.zip
0 Jan 11 20:57 events/events23
0 Jan 11 20:57 events/events23/a
0 Jan 11 20:57 events/events23/b
452 Jan 11 21:04 events/events23.zip

Hi Mike

I have installed the script and ensured that the path has been entered correctly, when the script was triggered by the cron, it seemed to start then stop. Upon checking the Events folder nothing had changed - any ideas?

Hey There,

Probably this line:

zip -r ${x}.zip.${TMP} ${x}

should have been written as

$ZIP -r ${x}.zip.${TMP} ${x}

since cron has problems sometimes with binaries called without absolute paths.

Also, just to be sure. For your cron entry, dump everything out to a log for the first few times, so if you entry was:

0 23 * * * /usr/local/bin/program

you could have

0 23 * * * /usr/local/bin/program >/tmp/OUTPUT 2>&1

and then you could see what output the script pumped out before it died.

Best wishes.

Mike

Hi Mike
Made the recommended changes and opened the log file in temp named 'OUTPUT' and the file is blank, nothing recorded in it.

Hey again,

The next thing to try would be to leave your cron entry the same, but on your shebang line in the script, instead of

#!/bin/bash

use

#!/bin/bash -x

That should guarantee you some output. I was hoping an obvious error would get sent out, but turning on xtrace for the script will give us more info than we need ...which is better than none ;)

best wishes,

Mike

Hi Mike

Got this from the OUTPUT file after implementing your previous instruction. I have put the •'s in

+ EVENTDIR=/domains/•/•/••••••••••••••••••.com/public_html/storage/events/
+ DELETE_OLD_ZIP_FILES=yes
+ ZIP=/usr/bin/zip
+ PID=3587
++ date +%m%d%y
+ DATE=011509
+ TMP=0115093587
+ find /domains/c/a/catalystglobal-vault.com/public_html/storage/events/ -type d -name 'events[0-9]*'
+ read x

Hey There,

JUST FYI - IMPORTANT NOTE FOR YOU - You dotted out the top path, but didn't dot out the path in the bash -x output. If this is material you don't want put out for public consumption, edit your post. Hopefully not too many people will have read it since you and I seem to be the only folks working on this. Don't want you to get in trouble!

Ah good, some output :)

It looks like the problem is in this line:

find /domains/c/a/catalystglobal-vault.com/public_html/storage/events/ -type d -name 'events[0-9]*'

for 'events[0-9]*' you need to use the double quotes I put in the original script, since they will allow for the variable interpolation to occur, whereas the single quotes don't. By way of explanation:

'events[0-9]*' actually equals -> events[0-9]*

which doesn't exist, so there's nothing to read.

"events[0-9]*" should equal events1 and events23 and events14, etc, so the loop will have something to read.

Once you make that change, I'd keep the #!/bin/bash -x in your shebang line and have the output keep going to the temp file, just in case that isn't all :)

Best wishes,

Mike

Hi Mike
Just checked the script and the double quotes are in place, (script is below), can't find a way to edit my previous post wherever I look. I did re-enter the double quotes thinking that may have done something but to no avail, the read out in OUTPUT is the same as previous.

#!/bin/bash -x


# Top level directory to look for event* sub-folders
EVENTDIR="/domains/*/*/**************.com/public_html/storage/events/"


# Set to "no" keep old zip file and add new file
DELETE_OLD_ZIP_FILES="yes"


# Path to zip executable
ZIP=/usr/bin/zip


# Unique $TMP extension for newly created zip files
# Temp extensions made up of PID of running process and
# date.  Ex from 1/11/09 with PID 23454: 01110923454
PID=$$
DATE=`date +%m%d%y`
TMP=${DATE}${PID}


# Find all events subdirs in main events dir - events1, events2, etc
# -name = events[0-9]* rather than events* to make sure the main events folder doesn't get added
find $EVENTDIR -type d -name "events[0-9]*"|while read x
do
# Then create a zip with contents of each and the name of the
# events folder with tmp extension appended.  Ex: events1.zip.01109.23454
$ZIP -r ${x}.zip.${TMP} ${x}
if [ $DELETE_OLD_ZIP_FILES == "yes" ]
then
# If our variable says to delete old zip files, move the temporary
# zip file to the straight name - e.g. events1.zip
mv ${x}.zip.${TMP} ${x}.zip
# Then, just to be sure, remove all possible temporary zip files
# left over from previous saves
rm -f ${x}.zip.*
else
# If our variable says to NOT delete the old zip files,
# if the zip file exists...
if [ -e  ${x}.zip ]
then
# swap the new temp zip file with the basic zip file
# name - e.g. events1.zip.011109.23454 <-> events1.zip
# First: move existing plain zip to uniquely named zip.bak file
mv ${x}.zip ${x}.zip.bak.${TMP}
# Next: Move our temp zip file to the plain zip file name
mv ${x}.zip.${TMP} ${x}.zip
# Then: Move the uniquely named zip.bak file to our temp zip name
mv ${x}.zip.bak.${TMP} ${x}.zip.${TMP}
else
# if no zip file exists, just move the temp zip name to the real one
mv ${x}.zip.${TMP}
fi
fi
done

Bummer,

BTW, can you let me know exactly what distro of Linux or Unix you're using? Then maybe I can replicate the problem just the same.

Also, I know these simple questions (no offense), but I forgot to ask before: when you run the script outside of cron, does it work? when you run the job outside of cron do you run it as root? If so, can you try it as whatever account executes cron command. If you have a crond user, then

su - crond

/what/you/have/in/cron/right/now

and that might show you an exception.

The only reasons I ask these questions now is that it appears as though the find command is not finding anything, so there's nothing to read in the while read loop.

Anyway, look forward to hearing back from you :)

, Mike

Hi Mike

Triggered the script off from the Terminal and got the read out below:

+ EVENTDIR=/domains/*/*/*************.com/public_html/storage/events/
+ DELETE_OLD_ZIP_FILES=yes
+ ZIP=/usr/bin/zip
+ PID=24493
++ date +%m%d%y
+ DATE=011609
+ TMP=01160924493
+ find /domains/*/*/*************.com/public_html/storage/events/ -type d -name 'events[0-9]*'
+ read x

Ubuntu 6.06 LTS is the Linux version I am running.

And I am running it from root.

Hey there,

Well that's good news of a sort, since it's bringing us closer to an answer. Since that gives you same result from the CLI, I would take a look at this find statement:

find /domains/*/*/*************.com/public_html/storage/events/ -type d -name 'events[0-9]*'

on its own. It's probably not returning anything. I would try it in order like:

find /domains/*/*/*************.com/public_html/storage/events/

if this returns nothing, then the initial directory isn't correct

find /domains/*/*/*************.com/public_html/storage/events/ -type d

if this returns nothing, then the initial directory doesn't have any directories in it (although it should because one of those directories would be itself)

find /domains/*/*/*************.com/public_html/storage/events/ -type d -name "events[0-9]*"

if this returns nothing, then we know the problem is with the pattern matching glob (literal events followed by any number of digits - events1, events2, events54, etc)

Let me know how that goes and post the output if you can. Your Ubuntu should be all right. I'm on 8.04 Hardy now, but I don't recall ever noticing that the basic find command's functionality changed all that much (if at all) between distro's.

Take it easy :)

, Mike

Hi mike

Sorry for sounding so dumb but are you wanting me to replace the whole line from:
find $EVENTDIR -type d -name "events[0-9]*"|while read x
to
find /domains/*/*/*************.com/public_html/storage/events/

Hey,

Don't worry. You don't sound dumb. If you were dumb, you wouldn't ask questions ;)

Actually if you could do the find command with your full path and then the same with $EVENTDIR, that would be a good double-test, even though you "should" get the same results - you could do

find $EVENTDIR -type d -name "events[0-9]*"

assuming $EVENTDIR has a value and

find /the/actual/path/to/your/dirs/ -type d -name "events[0-9]*"

The output from either of those should probably lead us to the root of the problem.

Best wishes, it's almost fixed :)

, Mike

Hi Mike

The scripts below both gave this output: (bold is were I made the changes)

+ EVENTDIR=/domains/•/•/••••••••••.com/public_html/storage/events/
+ DELETE_OLD_ZIP_FILES=yes
+ ZIP=/usr/bin/zip
+ PID=19150
++ date +%m%d%y
+ DATE=011909
+ TMP=01190919150
+ find /domains/•/•/••••••••••.com/public_html/storage/events/ -type d -name 'events[0-9]*'
+ read x




#!/bin/bash -x

# Top level directory to look for event* sub-folders
EVENTDIR="/domains/•/•/••••••••••.com/public_html/storage/events/"

# Set to "no" keep old zip file and add new file
DELETE_OLD_ZIP_FILES="yes"

# Path to zip executable
ZIP=/usr/bin/zip

# Unique $TMP extension for newly created zip files
# Temp extensions made up of PID of running process and
# date.  Ex from 1/11/09 with PID 23454: 01110923454
PID=$$
DATE=`date +%m%d%y`
TMP=${DATE}${PID}

# Find all events subdirs in main events dir - events1, events2, etc
# -name = events[0-9]* rather than events* to make sure the main events folder doesn't get added
**find /domains/•/•/••••••••••.com/public_html/storage/events/ -type d -name "events[0-9]*"|while read x**
do
        # Then create a zip with contents of each and the name of the
        # events folder with tmp extension appended.  Ex: events1.zip.01109.23454
        zip -r ${x}.zip.${TMP} ${x}
        if [ $DELETE_OLD_ZIP_FILES == "yes" ]
        then
                # If our variable says to delete old zip files, move the temporary
                # zip file to the straight name - e.g. events1.zip
                mv ${x}.zip.${TMP} ${x}.zip
                # Then, just to be sure, remove all possible temporary zip files
                # left over from previous saves
                rm -f ${x}.zip.*
        else
                # If our variable says to NOT delete the old zip files,
                # if the zip file exists...
                if [ -e  ${x}.zip ]
                then
                        # swap the new temp zip file with the basic zip file
                        # name - e.g. events1.zip.011109.23454 <-> events1.zip
                        # First: move existing plain zip to uniquely named zip.bak file
                        mv ${x}.zip ${x}.zip.bak.${TMP}
                        # Next: Move our temp zip file to the plain zip file name
                        mv ${x}.zip.${TMP} ${x}.zip
                        # Then: Move the uniquely named zip.bak file to our temp zip name
                        mv ${x}.zip.bak.${TMP} ${x}.zip.${TMP}
                else
                        # if no zip file exists, just move the temp zip name to the real one
                        mv ${x}.zip.${TMP}
                fi
        fi
done




#!/bin/bash -x

# Top level directory to look for event* sub-folders
EVENTDIR="/domains/•/•/••••••••••.com/public_html/storage/events/"

# Set to "no" keep old zip file and add new file
DELETE_OLD_ZIP_FILES="yes"

# Path to zip executable
ZIP=/usr/bin/zip

# Unique $TMP extension for newly created zip files
# Temp extensions made up of PID of running process and
# date.  Ex from 1/11/09 with PID 23454: 01110923454
PID=$$
DATE=`date +%m%d%y`
TMP=${DATE}${PID}

# Find all events subdirs in main events dir - events1, events2, etc
# -name = events[0-9]* rather than events* to make sure the main events folder doesn't get added
**find $EVENTDIR -type d -name "events[0-9]*"|while read x**
do
        # Then create a zip with contents of each and the name of the
        # events folder with tmp extension appended.  Ex: events1.zip.01109.23454
        zip -r ${x}.zip.${TMP} ${x}
        if [ $DELETE_OLD_ZIP_FILES == "yes" ]
        then
                # If our variable says to delete old zip files, move the temporary
                # zip file to the straight name - e.g. events1.zip
                mv ${x}.zip.${TMP} ${x}.zip
                # Then, just to be sure, remove all possible temporary zip files
                # left over from previous saves
                rm -f ${x}.zip.*
        else
                # If our variable says to NOT delete the old zip files,
                # if the zip file exists...
                if [ -e  ${x}.zip ]
                then
                        # swap the new temp zip file with the basic zip file
                        # name - e.g. events1.zip.011109.23454 <-> events1.zip
                        # First: move existing plain zip to uniquely named zip.bak file
                        mv ${x}.zip ${x}.zip.bak.${TMP}
                        # Next: Move our temp zip file to the plain zip file name
                        mv ${x}.zip.${TMP} ${x}.zip
                        # Then: Move the uniquely named zip.bak file to our temp zip name
                        mv ${x}.zip.bak.${TMP} ${x}.zip.${TMP}
                else
                        # if no zip file exists, just move the temp zip name to the real one
                        mv ${x}.zip.${TMP}
                fi
        fi
done

Hey Again :)

Actually I was just asking if you could run either of those command from the command line (outside of the script) and see the output from those :)

find /the/actual/path/to/your/dirs/ -type d -name "events[0-9]*"

all by itself should be good enough.

For example:

# find /var/tmp/test
/var/tmp/test
/var/tmp/test/a
/var/tmp/test/a/a.file
/var/tmp/test/b
/var/tmp/test/b/b.file

If we can "not" run the rest of the script, we'll be able to see if the "find" command is returning any values or not. I'm assuming that it's not, but just want to be sure and can't try it on your machine :)

Hi Mike

From the terminal I did a find with
find /domains/•/•/••••••••••t.com/public_html/storage/events/
and it came back with a read out of everything contained in the events folder and of course their paths, as there are 50 folders I won't paste the results

Hey There,

Okay - good :) As long as all you got back where directories and they were all named events1, events2, etc. If possible, can you PM me the output? If you're getting back any results you wouldn't expect and/or that output has spaces or single/double quotes, etc, that could be the issue.

I'd love to take a look at that output, since I can't replicate the issue on my computer.

Feel free to cut and paste and send me a PM. Since that's where you dead-end, I need to take a look at it to determine what step to take next.

If any of it's confidential, can you also just replace alphabetical characters with different alphabetical characters, etc. It's very important that the structure of the results remains intact. For instance a file name "hi there" would be an issue, but I'd never notice the space if it was sent as "********" :)

Best wishes,

Mike

Hi Mike

Just checking that you got the PM I sent through to you?

Hey again,

Yes, I did and (thank you so much for the find output) I realized that I have been misunderstanding you this entire time. I wrote you back via PM so as not to take up too much space, with one final question regarding what you need to find with the find statement.

Needless to say, what you wanted makes complete sense now (that is, I was either misunderstanding at what level you wanted to create the zips and, probably, because I assumed the events subdirectories started with the literal "events" and not the names of events ;)

Thanks for the info. We're almost home :)

, Mike

Hey again,

I sent you another PM - I think we have it this time (there's only, I think, one other option ;)

, Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.