LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-12-2016, 02:40 PM   #46
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242

Quote:
Originally Posted by trickydba View Post
You will not believe this..oh your code IS correct. I copied and pasted each line of your code in the command line and MANUALLY ran each line.it does EXACTLY what I need it to do. Why in the world will it not run in a script???? This is crazy!!! Yes, the file permissions has been changed to make it an executable
maybe it doesn't like you.

it does everything I asked it to in my terminal.

my code
Code:
#!/bin/bash
TODAY=$(date +%Y%m%d)
DIR0=/home/userx
DIR2=/home/userx/testfir

mkdir -p "${DIR2}"/"${TODAY}"
find "${DIR0}" -mindepth 1 -maxdepth 1 -type f -name "*.txt"  -mtime +1  -exec mv -vt "${DIR2}"/"${TODAY}"/ "{}" \+
notest +1 to see my files.


my test directory files are in is my base home directory.
Code:
entities_map.txt
 entry_points.txt
 error-sync-1480693849568.txt
 error-sync-1480693948804.txt
 error-sync-1480769255995.txt
 error-sync-1480790940650.txt
 error-sync-1480791033326.txt
 error-sync-1480791634450.txt
 error-sync-1480792236876.txt
 error-sync-1480792838334.txt
 error-sync-1480799478642.txt
 error-sync-1481025138746.txt
 error-sync-1481025232164.txt
 error-sync-1481065191153.txt
 error-sync-1481065791712.txt
 error-sync-1481071945414.txt
 error-sync-1481125339551.txt
 error-sync-1481133599624.txt
 error-sync-1481133690249.txt
 error-sync-1481134290877.txt
 error-sync-1481134893930.txt
 error-sync-1481134984455.txt
 error-sync-1481135584966.txt
 error-sync-1481136186682.txt
 error-sync-1481136277933.txt
 error-sync-1481136368814.txt
 error-sync-1481136459344.txt
 error-sync-1481137060886.txt
 error-sync-1481137151456.txt
 error-sync-1481137752223.txt
 error-sync-1481137842740.txt
 error-sync-1481138445510.txt
 error-sync-1481138540279.txt
 error-sync-1481139142325.txt
 error-sync-1481139232787.txt
 error-sync-1481139834055.txt
 error-sync-1481139924509.txt
 error-sync-1481140525612.txt
 error-sync-1481140616166.txt
 error-sync-1481141217625.txt
 error-sync-1481141308111.txt
 error-sync-1481141909133.txt
 error-sync-1481142511695.txt
 error-sync-1481142602329.txt
 error-sync-1481143203071.txt
 error-sync-1481143293612.txt
 error-sync-1481143894215.txt
 error-sync-1481144496051.txt
 error-sync-1481144586876.txt
 error-sync-1481145187580.txt
 error-sync-1481145788980.txt
 error-sync-1481146389867.txt
 error-sync-1481146991401.txt
 error-sync-1481147081903.txt
 error-sync-1481147682466.txt
 error-sync-1481148284103.txt
 error-sync-1481148374729.txt
 error-sync-1481148465204.txt
 error-sync-1481149066488.txt
 error-sync-1481149667613.txt
 error-sync-1481150268398.txt
 error-sync-1481205203693.txt
 error-sync-1481208572813.txt
 error-sync-1481209177449.txt
and many more. only looking for ending .txt files per oldest.

my create date dir and move to ... before running script.

Code:
userx@voided1.what~/testfir>> ls
userx@voided1.what~/testfir>>
it is empty

my script is in my bin directroy.

this is the command I use to run it. with output of what it is doing
Code:
userx@voided1.what~/bin>> ./mkandmv
'/home/userx/product key maybe not good .txt' -> '/home/userx/testfir/20161212/product key maybe not good .txt'
'/home/userx/error-sync-1480792236876.txt' -> '/home/userx/testfir/20161212/error-sync-1480792236876.txt'
'/home/userx/wdidle3_trace.txt' -> '/home/userx/testfir/20161212/wdidle3_trace.txt'
'/home/userx/error-sync-1481148465204.txt' -> '/home/userx/testfir/20161212/error-sync-1481148465204.txt'
'/home/userx/error-sync-1481065191153.txt' -> '/home/userx/testfir/20161212/error-sync-1481065191153.txt'
'/home/userx/CMakeCache.txt' -> '/home/userx/testfir/20161212/CMakeCache.txt'
'/home/userx/MBFFAQ.txt' -> '/home/userx/testfir/20161212/MBFFAQ.txt'
'/home/userx/lgpl.txt' -> '/home/userx/testfir/20161212/lgpl.txt'
'/home/userx/error-sync-1481145187580.txt' -> '/home/userx/testfir/20161212/error-sync-1481145187580.txt'
'/home/userx/error-sync-1481205203693.txt' -> '/home/userx/testfir/20161212/error-sync-1481205203693.txt'
'/home/userx/optimization.txt' -> '/home/userx/testfir/20161212/optimization.txt'
'/home/userx/license.txt' -> '/home/userx/testfir/20161212/license.txt'
'/home/userx/top_level.txt' -> '/home/userx/testfir/20161212/top_level.txt'
'/home/userx/pkcs11.txt' -> '/home/userx/testfir/20161212/pkcs11.txt'
'/home/userx/ReadMe.txt' -> '/home/userx/testfir/20161212/ReadMe.txt'
'/home/userx/error-sync-1481141909133.txt' -> '/home/userx/testfir/20161212/error-sync-1481141909133.txt'
'/home/userx/error-sync-1481025138746.txt' -> '/home/userx/testfir/20161212/error-sync-1481025138746.txt'
'/home/userx/error-sync-1480769255995.txt' -> '/home/userx/testfir/20161212/error-sync-1480769255995.txt'
'/home/userx/error-sync-1481146991401.txt' -> '/home/userx/testfir/20161212/error-sync-1481146991401.txt'
'/home/userx/error-sync-1481137842740.txt' -> '/home/userx/testfir/20161212/error-sync-1481137842740.txt'
'/home/userx/error-sync-1481136368814.txt' -> '/home/userx/testfir/20161212/error-sync-1481136368814.txt'
'/home/userx/error-sync-1481139142325.txt' -> '/home/userx/testfir/20161212/error-sync-1481139142325.txt'
'/home/userx/robots.txt' -> '/home/userx/testfir/20161212/robots.txt'
'/home/userx/error-sync-1481071945414.txt' -> '/home/userx/testfir/20161212/error-sync-1481071945414.txt'
'/home/userx/error-sync-1481134290877.txt' -> '/home/userx/testfir/20161212/error-sync-1481134290877.txt'
'/home/userx/error-sync-1481133690249.txt' -> '/home/userx/testfir/20161212/error-sync-1481133690249.txt'
'/home/userx/portinglog.txt' -> '/home/userx/testfir/20161212/portinglog.txt'
'/home/userx/Torrent downloaded from demonoid.pw.txt' -> '/home/userx/testfir/20161212/Torrent downloaded from demonoid.pw.txt'
'/home/userx/SiteSecurityServiceState.txt' -> '/home/userx/testfir/20161212/SiteSecurityServiceState.txt'
'/home/userx/snow.txt' -> '/home/userx/testfir/20161212/snow.txt'
'/home/userx/Anarchy in the Usa.txt' -> '/home/userx/testfir/20161212/Anarchy in the Usa.txt'
'/home/userx/error-sync-1481136186682.txt' -> '/home/userx/testfir/20161212/error-sync-1481136186682.txt'
'/home/userx/error-sync-1481148374729.txt' -> '/home/userx/testfir/20161212/error-sync-1481148374729.txt'
'/home/userx/MEGA-MASTERKEY.txt' -> '/home/userx/testfir/20161212/MEGA-MASTERKEY.txt'
'/home/userx/VERSION.txt' -> '/home/userx/testfir/20161212/VERSION.txt'
'/home/userx/native_libs.txt' -> '/home/userx/testfir/20161212/native_libs.txt'
'/home/userx/error-sync-1481138445510.txt' -> '/home/userx/testfir/20161212/error-sync-1481138445510.txt'
'/home/userx/Swallow My Pride.txt' -> '/home/userx/testfir/20161212/Swallow My Pride.txt'
'/home/userx/entry_points.txt' -> '/home/userx/testfir/20161212/entry_points.txt'
'/home/userx/error-sync-1481147081903.txt' -> '/home/userx/testfir/20161212/error-sync-1481147081903.txt'
'/home/userx/link.txt' -> '/home/userx/testfir/20161212/link.txt'
'/home/userx/README_LINUX_COMPILE.txt' -> '/home/userx/testfir/20161212/README_LINUX_COMPILE.txt'
'/home/userx/lang_list.txt' -> '/home/userx/testfir/20161212/lang_list.txt'
'/home/userx/readme.txt' -> '/home/userx/testfir/20161212/readme.txt'
'/home/userx/error-sync-1481141308111.txt' -> '/home/userx/testfir/20161212/error-sync-1481141308111.txt'
'/home/userx/error-sync-1481150268398.txt' -> '/home/userx/testfir/20161212/error-sync-1481150268398.txt'
'/home/userx/error-sync-1481142511695.txt' -> '/home/userx/testfir/20161212/error-sync-1481142511695.txt'
'/home/userx/error-sync-1481143203071.txt' -> '/home/userx/testfir/20161212/error-sync-1481143203071.txt'
'/home/userx/fvd.single.license.adult.txt' -> '/home/userx/testfir/20161212/fvd.single.license.adult.txt'
'/home/userx/manifest.txt' -> '/home/userx/testfir/20161212/manifest.txt'
'/home/userx/MBF.txt' -> '/home/userx/testfir/20161212/MBF.txt'
'/home/userx/README.txt' -> '/home/userx/testfir/20161212/README.txt'
'/home/userx/user_space_report.txt' -> '/home/userx/testfir/20161212/user_space_report.txt'
'/home/userx/ad_win_buttonmenu.txt' -> '/home/userx/testfir/20161212/ad_win_buttonmenu.txt'
'/home/userx/error-sync-1481137151456.txt' -> '/home/userx/testfir/20161212/error-sync-1481137151456.txt'
'/home/userx/error-sync-1481136459344.txt' -> '/home/userx/testfir/20161212/error-sync-1481136459344.txt'
'/home/userx/error-sync-1481139232787.txt' -> '/home/userx/testfir/20161212/error-sync-1481139232787.txt'
'/home/userx/bookmarks.txt' -> '/home/userx/testfir/20161212/bookmarks.txt'
'/home/userx/list.txt' -> '/home/userx/testfir/20161212/list.txt'
'/home/userx/error-sync-1480693849568.txt' -> '/home/userx/testfir/20161212/error-sync-1480693849568.txt'
'/home/userx/count.txt' -> '/home/userx/testfir/20161212/count.txt'
'/home/userx/error-sync-1481143894215.txt' -> '/home/userx/testfir/20161212/error-sync-1481143894215.txt'
'/home/userx/error-sync-1481140616166.txt' -> '/home/userx/testfir/20161212/error-sync-1481140616166.txt'
'/home/userx/soc.txt' -> '/home/userx/testfir/20161212/soc.txt'
'/home/userx/Torrent downloaded from demonoid.ph.txt' -> '/home/userx/testfir/20161212/Torrent downloaded from demonoid.ph.txt'
'/home/userx/error-sync-1481149066488.txt' -> '/home/userx/testfir/20161212/error-sync-1481149066488.txt'
'/home/userx/revocations.txt' -> '/home/userx/testfir/20161212/revocations.txt'
'/home/userx/ad_mac_buttonmenu.txt' -> '/home/userx/testfir/20161212/ad_mac_buttonmenu.txt'
'/home/userx/recent-files.txt' -> '/home/userx/testfir/20161212/recent-files.txt'
'/home/userx/error-sync-1481137752223.txt' -> '/home/userx/testfir/20161212/error-sync-1481137752223.txt'
'/home/userx/error-sync-1480790940650.txt' -> '/home/userx/testfir/20161212/error-sync-1480790940650.txt'
'/home/userx/release-notes.txt' -> '/home/userx/testfir/20161212/release-notes.txt'
'/home/userx/error-sync-1481142602329.txt' -> '/home/userx/testfir/20161212/error-sync-1481142602329.txt'
'/home/userx/recent_scans.txt' -> '/home/userx/testfir/20161212/recent_scans.txt'
'/home/userx/error-sync-1481144586876.txt' -> '/home/userx/testfir/20161212/error-sync-1481144586876.txt'
'/home/userx/error-sync-1481148284103.txt' -> '/home/userx/testfir/20161212/error-sync-1481148284103.txt'
'/home/userx/error-sync-1481025232164.txt' -> '/home/userx/testfir/20161212/error-sync-1481025232164.txt'
'/home/userx/Torrent Downloaded From ExtraTorrent.cc.txt' -> '/home/userx/testfir/20161212/Torrent Downloaded From ExtraTorrent.cc.txt'
'/home/userx/WEBMIN-STATUS-MIB.txt' -> '/home/userx/testfir/20161212/WEBMIN-STATUS-MIB.txt'
'/home/userx/requires.txt' -> '/home/userx/testfir/20161212/requires.txt'
'/home/userx/target_list.txt' -> '/home/userx/testfir/20161212/target_list.txt'
'/home/userx/error-sync-1480693948804.txt' -> '/home/userx/testfir/20161212/error-sync-1480693948804.txt'
'/home/userx/index.txt' -> '/home/userx/testfir/20161212/index.txt'
'/home/userx/ktorrent-20161014-170622.kcrash.txt' -> '/home/userx/testfir/20161212/ktorrent-20161014-170622.kcrash.txt'
'/home/userx/error-sync-1481209177449.txt' -> '/home/userx/testfir/20161212/error-sync-1481209177449.txt'
'/home/userx/boom.txt' -> '/home/userx/testfir/20161212/boom.txt'
'/home/userx/error-sync-1481146389867.txt' -> '/home/userx/testfir/20161212/error-sync-1481146389867.txt'
'/home/userx/error-sync-1480792838334.txt' -> '/home/userx/testfir/20161212/error-sync-1480792838334.txt'
'/home/userx/error-sync-1481136277933.txt' -> '/home/userx/testfir/20161212/error-sync-1481136277933.txt'
'/home/userx/Put Down that Weapon.txt' -> '/home/userx/testfir/20161212/Put Down that Weapon.txt'
'/home/userx/_translationstatus.txt' -> '/home/userx/testfir/20161212/_translationstatus.txt'
'/home/userx/lame-settings.txt' -> '/home/userx/testfir/20161212/lame-settings.txt'
'/home/userx/error-sync-1481139834055.txt' -> '/home/userx/testfir/20161212/error-sync-1481139834055.txt'
'/home/userx/error-sync-1481141217625.txt' -> '/home/userx/testfir/20161212/error-sync-1481141217625.txt'
'/home/userx/SOURCES.txt' -> '/home/userx/testfir/20161212/SOURCES.txt'
'/home/userx/error-sync-1481137060886.txt' -> '/home/userx/testfir/20161212/error-sync-1481137060886.txt'
'/home/userx/error-sync-1481134893930.txt' -> '/home/userx/testfir/20161212/error-sync-1481134893930.txt'
'/home/userx/README_en-US.txt' -> '/home/userx/testfir/20161212/README_en-US.txt'
'/home/userx/os_list.txt' -> '/home/userx/testfir/20161212/os_list.txt'
'/home/userx/error-sync-1481133599624.txt' -> '/home/userx/testfir/20161212/error-sync-1481133599624.txt'
'/home/userx/error-sync-1481135584966.txt' -> '/home/userx/testfir/20161212/error-sync-1481135584966.txt'
'/home/userx/entities_map.txt' -> '/home/userx/testfir/20161212/entities_map.txt'
'/home/userx/fvd.single.license.usage.txt' -> '/home/userx/testfir/20161212/fvd.single.license.usage.txt'
'/home/userx/ad_win.txt' -> '/home/userx/testfir/20161212/ad_win.txt'
'/home/userx/error-sync-1481140525612.txt' -> '/home/userx/testfir/20161212/error-sync-1481140525612.txt'
'/home/userx/prboom.txt' -> '/home/userx/testfir/20161212/prboom.txt'
'/home/userx/README_OS2_COMPILE.txt' -> '/home/userx/testfir/20161212/README_OS2_COMPILE.txt'
'/home/userx/ChangeLog.txt' -> '/home/userx/testfir/20161212/ChangeLog.txt'
'/home/userx/error-sync-1481145788980.txt' -> '/home/userx/testfir/20161212/error-sync-1481145788980.txt'
'/home/userx/error-sync-1480791033326.txt' -> '/home/userx/testfir/20161212/error-sync-1480791033326.txt'
'/home/userx/urlclassifierkey3.txt' -> '/home/userx/testfir/20161212/urlclassifierkey3.txt'
'/home/userx/ascii.txt' -> '/home/userx/testfir/20161212/ascii.txt'
'/home/userx/nota-bahasa-malaysia.txt' -> '/home/userx/testfir/20161212/nota-bahasa-malaysia.txt'
'/home/userx/ad_mac.txt' -> '/home/userx/testfir/20161212/ad_mac.txt'
'/home/userx/error-sync-1481138540279.txt' -> '/home/userx/testfir/20161212/error-sync-1481138540279.txt'
'/home/userx/CMakeRuleHashes.txt' -> '/home/userx/testfir/20161212/CMakeRuleHashes.txt'
'/home/userx/error-sync-1481134984455.txt' -> '/home/userx/testfir/20161212/error-sync-1481134984455.txt'
'/home/userx/font.txt' -> '/home/userx/testfir/20161212/font.txt'
'/home/userx/superfish_titles.txt' -> '/home/userx/testfir/20161212/superfish_titles.txt'
'/home/userx/error-sync-1481147682466.txt' -> '/home/userx/testfir/20161212/error-sync-1481147682466.txt'
'/home/userx/README_OSX_COMPILE.txt' -> '/home/userx/testfir/20161212/README_OSX_COMPILE.txt'
'/home/userx/dependency_links.txt' -> '/home/userx/testfir/20161212/dependency_links.txt'
'/home/userx/error-sync-1480799478642.txt' -> '/home/userx/testfir/20161212/error-sync-1480799478642.txt'
'/home/userx/error-sync-1481125339551.txt' -> '/home/userx/testfir/20161212/error-sync-1481125339551.txt'
'/home/userx/error-sync-1481144496051.txt' -> '/home/userx/testfir/20161212/error-sync-1481144496051.txt'
'/home/userx/issue_tracker.txt' -> '/home/userx/testfir/20161212/issue_tracker.txt'
'/home/userx/ffmpeg_powerpc_performance_evaluation_howto.txt' -> '/home/userx/testfir/20161212/ffmpeg_powerpc_performance_evaluation_howto.txt'
'/home/userx/error-sync-1481143293612.txt' -> '/home/userx/testfir/20161212/error-sync-1481143293612.txt'
'/home/userx/error-sync-1481208572813.txt' -> '/home/userx/testfir/20161212/error-sync-1481208572813.txt'
'/home/userx/CMakeLists.txt' -> '/home/userx/testfir/20161212/CMakeLists.txt'
'/home/userx/error-sync-1480791634450.txt' -> '/home/userx/testfir/20161212/error-sync-1480791634450.txt'
'/home/userx/error-sync-1481139924509.txt' -> '/home/userx/testfir/20161212/error-sync-1481139924509.txt'
'/home/userx/avutil.txt' -> '/home/userx/testfir/20161212/avutil.txt'
'/home/userx/GPLv2.txt' -> '/home/userx/testfir/20161212/GPLv2.txt'
'/home/userx/README_WIN32_COMPILE.txt' -> '/home/userx/testfir/20161212/README_WIN32_COMPILE.txt'
'/home/userx/LGPL.txt' -> '/home/userx/testfir/20161212/LGPL.txt'
'/home/userx/error-sync-1481149667613.txt' -> '/home/userx/testfir/20161212/error-sync-1481149667613.txt'
'/home/userx/error-sync-1481065791712.txt' -> '/home/userx/testfir/20161212/error-sync-1481065791712.txt'
'/home/userx/notice.txt' -> '/home/userx/testfir/20161212/notice.txt'
'/home/userx/RESULTS.txt' -> '/home/userx/testfir/20161212/RESULTS.txt'
'/home/userx/TargetDirectories.txt' -> '/home/userx/testfir/20161212/TargetDirectories.txt'
'/home/userx/ad_signs.txt' -> '/home/userx/testfir/20161212/ad_signs.txt'
userx@voided1.what~/bin>>
this is now what my test files to directory looks like.

Code:
userx@voided1.what~/testfir>> ls
20161212
userx@voided1.what~/testfir>>
this is what is inside of the dated directory my script did.
Code:
userx@voided1.what~/testfir>> ls 20161212
'Anarchy in the Usa.txt'
 CMakeCache.txt
 CMakeLists.txt
 CMakeRuleHashes.txt
 ChangeLog.txt
 GPLv2.txt
 LGPL.txt
 MBF.txt
 MBFFAQ.txt
 MEGA-MASTERKEY.txt
'Put Down that Weapon.txt'
 README.txt
 README_LINUX_COMPILE.txt
 README_OS2_COMPILE.txt
 README_OSX_COMPILE.txt
 README_WIN32_COMPILE.txt
 README_en-US.txt
 RESULTS.txt
 ReadMe.txt
 SOURCES.txt
 SiteSecurityServiceState.txt
'Swallow My Pride.txt'
 TargetDirectories.txt
'Torrent Downloaded From ExtraTorrent.cc.txt'
'Torrent downloaded from demonoid.ph.txt'
'Torrent downloaded from demonoid.pw.txt'
 VERSION.txt
 WEBMIN-STATUS-MIB.txt
 _translationstatus.txt
 ad_mac.txt
 ad_mac_buttonmenu.txt
 ad_signs.txt
 ad_win.txt
 ad_win_buttonmenu.txt
 ascii.txt
 avutil.txt
 bookmarks.txt
 boom.txt
 count.txt
 dependency_links.txt
 entities_map.txt
 entry_points.txt
 error-sync-1480693849568.txt
 error-sync-1480693948804.txt
 error-sync-1480769255995.txt
 error-sync-1480790940650.txt
 error-sync-1480791033326.txt
 error-sync-1480791634450.txt
 error-sync-1480792236876.txt
 error-sync-1480792838334.txt
 error-sync-1480799478642.txt
 error-sync-1481025138746.txt
 error-sync-1481025232164.txt
 error-sync-1481065191153.txt
 error-sync-1481065791712.txt
 error-sync-1481071945414.txt
 error-sync-1481125339551.txt
 error-sync-1481133599624.txt
 error-sync-1481133690249.txt
 error-sync-1481134290877.txt
 error-sync-1481134893930.txt
 error-sync-1481134984455.txt
 error-sync-1481135584966.txt
 error-sync-1481136186682.txt
 error-sync-1481136277933.txt
 error-sync-1481136368814.txt
 error-sync-1481136459344.txt
 error-sync-1481137060886.txt
 error-sync-1481137151456.txt
 error-sync-1481137752223.txt
 error-sync-1481137842740.txt
 error-sync-1481138445510.txt
 error-sync-1481138540279.txt
 error-sync-1481139142325.txt
 error-sync-1481139232787.txt
 error-sync-1481139834055.txt
 error-sync-1481139924509.txt
 error-sync-1481140525612.txt
 error-sync-1481140616166.txt
 error-sync-1481141217625.txt
 error-sync-1481141308111.txt
 error-sync-1481141909133.txt
 error-sync-1481142511695.txt
 error-sync-1481142602329.txt
 error-sync-1481143203071.txt
 error-sync-1481143293612.txt
 error-sync-1481143894215.txt
 error-sync-1481144496051.txt
 error-sync-1481144586876.txt
 error-sync-1481145187580.txt
 error-sync-1481145788980.txt
 error-sync-1481146389867.txt
 error-sync-1481146991401.txt
 error-sync-1481147081903.txt
 error-sync-1481147682466.txt
 error-sync-1481148284103.txt
 error-sync-1481148374729.txt
 error-sync-1481148465204.txt
 error-sync-1481149066488.txt
 error-sync-1481149667613.txt
 error-sync-1481150268398.txt
 error-sync-1481205203693.txt
 error-sync-1481208572813.txt
 error-sync-1481209177449.txt
 ffmpeg_powerpc_performance_evaluation_howto.txt
 font.txt
 fvd.single.license.adult.txt
 fvd.single.license.usage.txt
 index.txt
 issue_tracker.txt
 ktorrent-20161014-170622.kcrash.txt
 lame-settings.txt
 lang_list.txt
 lgpl.txt
 license.txt
 link.txt
 list.txt
 manifest.txt
 native_libs.txt
 nota-bahasa-malaysia.txt
 notice.txt
 optimization.txt
 os_list.txt
 pkcs11.txt
 portinglog.txt
 prboom.txt
'product key maybe not good .txt'
 readme.txt
 recent-files.txt
 recent_scans.txt
 release-notes.txt
 requires.txt
 revocations.txt
 robots.txt
 snow.txt
 soc.txt
 superfish_titles.txt
 target_list.txt
 top_level.txt
 urlclassifierkey3.txt
 user_space_report.txt
 wdidle3_trace.txt
so here where I am at it works.
what are you doing wrong?

Last edited by BW-userx; 12-12-2016 at 02:42 PM.
 
Old 12-13-2016, 07:06 AM   #47
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
My issue has been resolved using BW-userx code:

#!/bin/bash
TODAY=$(date +%Y%m%d)
DIR0=/home/userx
DIR2=/home/userx/testfir

mkdir -p "${DIR2}"/"${TODAY}"
find "${DIR0}" -mindepth 1 -maxdepth 1 -type f -name "*.xlsx" -mtime -1 -exec mv -t "${DIR2}"/"${TODAY}"/ "{}" \+


Even though this code works, it only works when I manually insert each line. It's not his code, something else is going on that I cannot figure out. I don't want to abuse this forum by constantly asking questions. I appreciate everyone's help!!!!
 
Old 12-13-2016, 08:32 AM   #48
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by trickydba View Post
My issue has been resolved using BW-userx code:

#!/bin/bash
TODAY=$(date +%Y%m%d)
DIR0=/home/userx
DIR2=/home/userx/testfir

mkdir -p "${DIR2}"/"${TODAY}"
find "${DIR0}" -mindepth 1 -maxdepth 1 -type f -name "*.xlsx" -mtime -1 -exec mv -t "${DIR2}"/"${TODAY}"/ "{}" \+


Even though this code works, it only works when I manually insert each line. It's not his code, something else is going on that I cannot figure out. I don't want to abuse this forum by constantly asking questions. I appreciate everyone's help!!!!
why are you using my path directives? you have to tailor it to your needs (system).
or do you actually have a user in your system named userx too?

Do you have a good understanding of ownership, and permissions when dealing with Linux? fair to midland even.

Change the paths in that code to meet your needs. Issue a
Code:
chmod +x TheFileNameOfThatScript
Hit enter. Just do it anyways.

run it in a terminal. Hopefully you understand how to select text in the terminal, do that too, just do it. then paste it in here using code tags. everything that is states so I and others can see it.

then in that same post paste your actual code that is in that same script you ran in the same post, using code tags.

just do it, enough with the it works but only when I do it by hand. That is not enough information to help you.

Last edited by BW-userx; 12-13-2016 at 08:38 AM.
 
Old 12-13-2016, 09:13 AM   #49
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,487

Rep: Reputation: 1557Reputation: 1557Reputation: 1557Reputation: 1557Reputation: 1557Reputation: 1557Reputation: 1557Reputation: 1557Reputation: 1557Reputation: 1557Reputation: 1557
Something to look out for and check with your sysadmin, you may be trying to create your script within a mountpoint that has "noexec" set.
 
Old 12-13-2016, 11:56 AM   #50
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
@TenTenths.....that's an interesting note. I will ask!
@BW-userx..... I did put my own paths in, just didn't post them. See this script is executed in an application called Oracle EDQ. The user logged into EDQ is 'oracle' , but the user that is able to access Linux to Windows shared folder is my username, which I'll say is 'eric'. I have sudo access using the user 'oracle'. So in the script, when it starts, the user 'oracle' is in use, then to access the ability to transfer files from linux to windows I have to log out of 'oracle' and log in to 'eric'. I think EDQ is giving the error cause it thinks I'm logging out as 'oracle'. The user 'eric' does not have access in EDQ.

I'm not giving up, but I can't reopen this thread. I'll just keep trying, I just didn't want to abuse this forum and possibly get kicked out.
 
Old 12-13-2016, 12:08 PM   #51
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Ok, lets say before his script is ran, right in the beginning of the script(which would be ran using the username 'oracle') I needed to send a "log out" command to log out of 'oracle', which would make me automatically logged in as 'eric'. How can I do this in the beginning of the script? Even before the variables are defined?
 
Old 12-13-2016, 12:13 PM   #52
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by trickydba View Post
Ok, lets say before his script is ran, right in the beginning of the script(which would be ran using the username 'oracle') I needed to send a "log out" command to log out of 'oracle', which would make me automatically logged in as 'eric'. How can I do this in the beginning of the script? Even before the variables are defined?
Oh now the truth comes out, you're trying to run this through 3rd party software. leaving out details creates nothing but problems.

time to school yourself
http://www.oracle.com/technetwork/ar...ng-088882.html

Last edited by BW-userx; 12-13-2016 at 12:20 PM.
 
Old 12-13-2016, 12:20 PM   #53
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I apologize, I didn't think running the script through EDQ would matter, it only executes the script, just like executing a script from command line.
 
Old 12-13-2016, 12:22 PM   #54
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by trickydba View Post
I apologize, I didn't think running the script through EDQ would matter, it only executes the script, just like executing a script from command line.
I have no idea, but I am sure their has to be a bit of fanaggiing first to get it to work.

https://oracle-base.com/articles/mis...hell-scripting

Last edited by BW-userx; 12-13-2016 at 12:24 PM.
 
Old 12-13-2016, 12:23 PM   #55
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Thank you
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy the List of all folder in a file richa07 Linux - Newbie 8 07-03-2013 12:03 PM
[SOLVED] how to just copy the folder not the file ytyyutianyun Linux - Newbie 2 11-19-2011 04:47 AM
i cannot copy a file to a folder in file system with my root account realbezo Linux - Newbie 4 03-03-2009 10:45 PM
Copy File While File is Creating in Disk suhas7860 Linux - General 4 04-03-2007 08:38 AM
copy a file to all subdirectories in a folder raj000 Linux - General 6 03-24-2006 03:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration