alisson
Posts: 5
Joined: Mon Jan 01, 2018 4:13 pm

Copy files using boot service to different folders

Fri Jan 05, 2018 2:10 pm

Hello guys,

I have a file management problem and would like to find a smarter and more dynamic solution, but that is beyond my current skills.
I have a local Pi3 server running samba, with two shared folders.

Code: Select all

    Folder 01: Private folder containing default files for users;
    Folder 02: Public folder containing the default files and other users files.
Every time that We restart the Pi server, the system copy the default files in private folder to the public folder. This is to prevent users from leaving modified files in the public folder, for example:

Code: Select all

    cp /home/pi/adm-priv/file-def01.png /home/pi/public/file-def01.png
    cp /home/pi/adm-priv/file-logo.png /home/pi/public/file-logo.png
This is working fine, but I can not handle the default files that users use in new folders. Users have their reasons for using these files in new folders, and I have to add new locations to the service archiver eventually.
Example:

Code: Select all

    **Today** > the files are in the /public
    **Tomorrow** > for the users' reasons, the files are in the /public/tests_01
    **On another day** > the files may be in /public/tests_01 and /public/test_02
Then, every time the Pi3 server restarts.. We copy the default files with a boot service, replacing all files in the known folders.

My problem is how to run a smart boot service, which looks for the all location of the default files and changes them.
** The "default files/default folder" is one folder with 13 png files, but maybe folder change the name.. Files never change name. So, finding one file, we find the folder with all files.

I tried find files with command:

Code: Select all

    find . -name filename.extension
But I do not know how to implement this to automate the boot service.
I need help!

Return to “General discussion”