Advertisement
plirof2

bash-linux scan folder and create .desktop files -v01e

Dec 15th, 2020 (edited)
767
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.56 KB | None | 0 0
  1. #bash-linux scan folder and create .desktop files
  2. # v01 -201216d
  3. yourfilenames=`ls /appimages/*/*.?pp?mage`
  4.  
  5. for FILE in $yourfilenames;
  6.     do
  7.         LAST_FOLDER=$(basename $(dirname $FILE))
  8.         #echo $(basename "${FILE%.*}".AppImage)
  9.         echo $(basename "${FILE%}")
  10.         echo "LAST FOLDER="$LAST_FOLDER
  11.         #echo $FILE;
  12.     done
  13.  
  14.  
  15.  
  16. yourfilenames=`ls /appimages/*/*.?pp?mage`
  17.  
  18. #for FILE in /appimages/*.?pp?mage;
  19. for FILE in $yourfilenames;
  20.     do
  21. LAST_FOLDER=$(basename $(dirname $FILE))
  22. DESKTOP_FILENAME=$LAST_FOLDER"-"$(basename "${FILE%}")".desktop"
  23. #echo $FILE;
  24.  
  25. #cat > "/tmp/aa/chromium-browser_changesdat-aa.xx" << EOF3
  26. #cat > "/tmp/aa/chromium-browser_changesdat-"${FILE%%.*}.desktop << EOF3
  27. #mkdir -p /tmp/aa/;cat > "/tmp/aa/AppImage-"$(basename "${FILE%}").desktop << EOF3
  28. #mkdir -p /root/Desktop/AppImages;cat > "/root/Desktop/AppImages/AppImage-"$(basename "${FILE%}").desktop << EOF3
  29. #cat > "/usr/local/share/applications/AppImage-"$LAST_FOLDER"-"$(basename "${FILE%}").desktop << EOF3
  30. #mkdir -p /root/Desktop/AppImages;cat > "/usr/local/share/applications/AppImage-"$DESKTOP_FILENAME << EOF3
  31. mkdir -p /root/Desktop/AppImages;cat > "/root/Desktop/AppImages/AppImage-"$DESKTOP_FILENAME << EOF3
  32. [Desktop Entry]
  33. Version=1.0
  34. Name=$DESKTOP_FILENAME
  35. Exec=$FILE
  36. Terminal=false
  37. #X-MultipleArgs=false
  38. Type=Application
  39. #Icon=/usr/share/pixmaps/chromium.xpm
  40. Categories=X-AppImages;
  41. StartupNotify=true
  42. EOF3
  43. chmod u+x "/root/Desktop/AppImages/AppImage-"$DESKTOP_FILENAME
  44. ln -s "/root/Desktop/AppImages/AppImage-"$DESKTOP_FILENAME /usr/local/share/applications
  45.  
  46.     done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement