sync or ftp two folder together in same domain

cPanel & WHM Version
cpanel 11 WHM 78.0.49

KimberH

Member
Dec 29, 2013
24
3
53
cPanel Access Level
Website Owner
Hi, I need to set up a way for when audio files are upload to a folder (wordpress media folder) for all or selected files to copy over to the another folder in the same cpanel but not in wordpress directory.

I can do steps 1 & 2. Can step 3 be set up in cpanel?

The steps are:
1) admin/user uploads the audio file to wordpress media. This file Ihas the same name as a file already in the media library.
2) an overwrite plugin overwrite the audio file of the same name in t khe wordpress media library.
3) the audio file is then send to the second folder and replaces the file of the same name.


I know this website is on a very old version of cpanel and trying to get the client to allow me to update.
Thank you for your time
Kimberly
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,250
313
Houston
Step 3 would need to be a custom script - most likely something you'd execute through a cron, there's nothing in cPanel that would be able to be triggered when a new file you upload and automate a move. WHM has hookable events but they wouldn't cover this specifically.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,250
313
Houston
It wouldn't be the FTP service that would be the issue, it'd be triggering the automation and I don't think you'd really want to use FTP to transfer files on the same server to a different location

Something like this would search for files of type .mp3 and copy them to a chosen directory:

Code:
$ find /home/$user/public_html/uploaddir/ -iname '*.mp3' -exec cp {} /home/$user/public_html/copytodir/ \;
By default, unless you use the -i or -n flag the cp command should overwrite - you would need to call the specific directories here and it would be recursive if there were mp3 files below targeted directory they would also be copied. You can replace the cp command with the mv command in the event you want to just move the files rather than copy them
 
  • Like
Reactions: KimberH

KimberH

Member
Dec 29, 2013
24
3
53
cPanel Access Level
Website Owner
It wouldn't be the FTP service that would be the issue, it'd be triggering the automation and I don't think you'd really want to use FTP to transfer files on the same server to a different location

Something like this would search for files of type .mp3 and copy them to a chosen directory:

Code:
$ find /home/$user/public_html/uploaddir/ -iname '*.mp3' -exec cp {} /home/$user/public_html/copytodir/ \;
By default, unless you use the -i or -n flag the cp command should overwrite - you would need to call the specific directories here and it would be recursive if there were mp3 files below targeted directory they would also be copied. You can replace the cp command with the mv command in the event you want to just move the files rather than copy them
Thank you for all your help. This might be a job I have to outsource, I don't understand enough of this.

Kim
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,250
313
Houston
We have a list of system administrators (many of whom have several certifications related to cPanel) that may be able to help should you choose to go that route. You can find them here: System Administration Services
 

KimberH

Member
Dec 29, 2013
24
3
53
cPanel Access Level
Website Owner
It wouldn't be the FTP service that would be the issue, it'd be triggering the automation and I don't think you'd really want to use FTP to transfer files on the same server to a different location

Something like this would search for files of type .mp3 and copy them to a chosen directory:

Code:
$ find /home/$user/public_html/uploaddir/ -iname '*.mp3' -exec cp {} /home/$user/public_html/copytodir/ \;
By default, unless you use the -i or -n flag the cp command should overwrite - you would need to call the specific directories here and it would be recursive if there were mp3 files below targeted directory they would also be copied. You can replace the cp command with the mv command in the event you want to just move the files rather than copy them
I'd really like to spend the weekend learning before hiring someone. I'm a freelancer with a very small budget. Can you tell me where a code like this would go so I can read on on that. Is it a cron job?

Code:
$ find /home/$user/public_html/uploaddir/ -iname '*.mp3' -exec cp {} /home/$user/public_html/copytodir/ \;
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,250
313
Houston
That would be something you'd enter in the CLI - this isn't specific to cPanel but more so specific to Linux. You might want to look at some info on learning Linux if your interest is more so in using bash Home | Linux Journey