Jump to content
[[Template core/front/custom/_customHeader is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

Any unix/database people in da house?


Caveman_Nick
 Share

Recommended Posts

I have a process that I am trying to create, and as part of the process I need to pick a folder name out of a path. More specifically I need to drop an item into a folder and capture the name of the parent folder (the folder I am dropping the item into) as output for use as a variable (to add as metadata, send an email, etc.)

 

Anyone know of a script that might capture this data?

Link to comment
Share on other sites

I have a process that I am trying to create, and as part of the process I need to pick a folder name out of a path. More specifically I need to drop an item into a folder and capture the name of the parent folder (the folder I am dropping the item into) as output for use as a variable (to add as metadata, send an email, etc.)

 

Anyone know of a script that might capture this data?

Could you pipe the output from the LS command to a parser and grab the bit you need from there? Caveat: I know very little about UNIX (did my UNIX admin class in 1995 and really haven't done much since)

Edited by Ursa Majoris
Link to comment
Share on other sites

Could you pipe the output from the LS command to a parser and grab the bit you need from there? Caveat: I know very little about UNIX (did my UNIX admin class in 1995 and really haven't done much since)

 

:wacko:

 

Looking for an existing script that does what I am looking for...don't know much about scripting and can't find one with google. Maybe that would work, but I am not quite educated with it enough to say.

Link to comment
Share on other sites

Do I have your procedure correct?

 

You have a file.

You have a path like this: /usr/local/caveman/nick/

You need to drop that file into: /usr/local/caveman/

 

Do you know the directory path beforehand? How will you be "dropping" it in? FTP, SCP, Something else? Is the file already on the file system?

Link to comment
Share on other sites

Do I have your procedure correct?

 

You have a file.

You have a path like this: /usr/local/caveman/nick/

You need to drop that file into: /usr/local/caveman/

 

Do you know the directory path beforehand? How will you be "dropping" it in? FTP, SCP, Something else? Is the file already on the file system?

 

I have a file. I want to drop that file into a directory. When I drop that file into the directory, I can use that as a trigger to run a defined action of sending a notification email out.

 

I can hard code email addresses into my database so that the system knows who to email. That would make a bit of a mess in the administration area because of the number of different recipients. What I would prefer to do is name each folder with the email address of the recipient, and then have the action be able to pick this email address off of the folder name. In order to do so, I need to be able to capture the string in some reliable fashion.

 

So, the directory structure would look like:

 

/raid/jobs/Some_Client_Folder/Proof_Room/Client_Review/some_person@some_company.com/some_file.pdf

 

When some_file.pdf gets dropped into the folder some_person@some_company.com, I want that action to trigger a script that will report the name of the folder (not the whole path) that the file was dropped into.

Link to comment
Share on other sites

I have a file. I want to drop that file into a directory. When I drop that file into the directory, I can use that as a trigger to run a defined action of sending a notification email out.

 

I can hard code email addresses into my database so that the system knows who to email. That would make a bit of a mess in the administration area because of the number of different recipients. What I would prefer to do is name each folder with the email address of the recipient, and then have the action be able to pick this email address off of the folder name. In order to do so, I need to be able to capture the string in some reliable fashion.

 

So, the directory structure would look like:

 

/raid/jobs/Some_Client_Folder/Proof_Room/Client_Review/some_person@some_company.com/some_file.pdf

 

When some_file.pdf gets dropped into the folder some_person@some_company.com, I want that action to trigger a script that will report the name of the folder (not the whole path) that the file was dropped into.

So at the risk of telling you what you already know and in the interests of clarity, you need a daemon that monitors the structure and when a file arrives, the daemon runs a short script that captures the folder name reading forwards from the last forward slash in the full path.

Edited by Ursa Majoris
Link to comment
Share on other sites

So at the risk of telling you what you already know and in the interests of clarity, you need a daemon that monitors the structure and when a file arrives, the daemon runs a short script that captures the folder name reading forwards from the last forward slash in the full path.

 

Pretty much this.

 

I doubt you'll find anything on the innertubes already made to do this but it should be fairly easy to create. If there are databases that need to be queried/other actions that need to be done by this script then it gets a little more complex.

Link to comment
Share on other sites

So at the risk of telling you what you already know and in the interests of clarity, you need a daemon that monitors the structure and when a file arrives, the daemon runs a short script that captures the folder name reading forwards from the last forward slash in the full path.

 

 

Pretty much this.

 

I doubt you'll find anything on the innertubes already made to do this but it should be fairly easy to create. If there are databases that need to be queried/other actions that need to be done by this script then it gets a little more complex.

 

I understand what I need....just looking for someone that knows how to do it. Nothing needs to be queried. I just need a script that will pick a folder name out of a path. I can work the rest.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information