create a zip file

Im fairly new to bash but I wanted to know about an idea I had to stream my file process these days. I modify .html, and .xml files and usually will take the files right click, create .zip, add files, rename, and cut the zip out of the folder and paste into another folder. I KNOW bash should be able to do this but Im still fairly new into HOW and WHAT is going on.

From reading around and searching here I get this idea:

#!/bin/bash

##Location of files
DIR="/mnt/windows/files"

##Location of files being zipped
PROCESS="/mnt/windows/running"

##completed zipped files
ZIPPED="mnt/windows/zipped"

##original location of files
ORIG="mnt/windows/originals"

cd "$DIR"

## Move files locally
cp -v $DIR/* $PROCESS
mv -v  $DIR/* $ORIG

## check directory being process
cd $PROCESS

for folder in $(ls "$PROCESS"); do
	echo 
	echo ===========================
	echo
	zip -x $PROCESS/$folder
	mv -v $PROCESS/$folder 
	 
done

suggestions, ideas, or direction would be great

zip file.zip file

try something like this

You can just zip the files and then remove them if the zip process was sucessful, Check out the following example:

#!/bin/bash
# Location of files to zip
DIR="/mnt/windows/files"

# Location where to create zip files
ZIPPED="/mnt/windows/zipped"


# Zip files
zip $ZIPPED/zipfile $DIR/*

# Remove files zipped
if [ $? -eq 0 ]; then
  rm $DIR/*
else
  echo "**Error occurred during zip..."
fi

i cant even run that for some reason in ubuntu's terminal. I get all kinds of command not found errors.

What command is not found, exactly? If you don't have zip, install it.

I believe I have zip installed. I get a $'\r': command not found

As Corona688 said, Try each line individually from command line and show us(i.e. post) all the output that goes to the screen.

Sounds like the script file is in DOS format (perhaps you edited/created it in windows), try this in ubuntu:

$ dos2unix your_script.sh

I found this last night when I was doing a search. Now the issue is the zip file creates the folder structure with the zip which is not what I need. Meaning: Folder>Folder>Folder>contents because the bash script calls the directory

what I referenced

EDIT:
I also need the zip folders a certain way. I need it to be zip>contents not zip>folder>contents.

This error means, "stop editing your UNIX scripts in Microsoft Notepad".

zip file.zip folder/* then.

i use notepad++ language shell and save as .sh

better suggestion??

Edit your UNIX scripts in UNIX using a UNIX text editor like vim, vi, nano, pico, emacs, or whatever you want. Don't do it in Microsoft Windows.

Use the "-j" option to not store the path:

# Zip files
zip -j $ZIPPED/zipfile $DIR/*

-j  Store  just the name of a saved file (junk the path), and do not
    store directory names. By default, zip will store the full  path
    (relative to the current path).