# \[command\] Batch save files contained in a folder

**URL:** https://community.aseprite.org/t/command-batch-save-files-contained-in-a-folder/2092
**Category:** Help
**Created:** [October 10, 2018, 1:05pm UTC](https://community.aseprite.org/t/command-batch-save-files-contained-in-a-folder/2092 "2018-10-10T13:05:17Z")
**Posts on this page:** 1
**Page:** 2

<div class="post-metadata">

### Author: ![J-A\_C](https://community.aseprite.org/user_avatar/community.aseprite.org/j-a_c/32/11133_2.png) [@J-A\_C](https://community.aseprite.org/u/J-A_C)
#### Post date: [October 27, 2018, 11:50am UTC](https://community.aseprite.org/t/command-batch-save-files-contained-in-a-folder/2092/21 "2018-10-27T11:50:51Z")

</div>

This code works in the command prompt, but not when I click on the file in the explorer.

```
#!/bin/bash
chmod +x test.sh

rm -rf D:/00_TAKROG/ATLAS_UNITS_AND_DOODADS/*
rm -rf D:/00_TAKROG/ATLAS_UNITS_AND_DOODADS_TEMPORARY/*
rm -rf D:/00_TAKROG/SPRITES/CHARACTERS/FACES/*

aseprite=“C:/Program Files (x86)/Steam/steamapps/common/Aseprite/aseprite.exe”

for file in D:/00_TAKROG/SPRITES/CHARACTERS/*.ase ; do
	
	if [["$(basename -- "$file")" == "faces.ase"]]; then
		echo "exporting $file"
		"$aseprite" -b $file --save-as D:/00_TAKROG/SPRITES/CHARACTERS/FACES/{tag}.png
				
	elif [["$(basename -- "$file")" == "items.ase"]]; then
		echo "exporting $file"
		"$aseprite" -b --split-layers $file --save-as D:/00_TAKROG/ATLAS_UNITS_AND_DOODADS/{layer}_{tag}_01.png
	
	else
		echo "exporting $file"
		"$aseprite" -b $file --save-as D:/00_TAKROG/ATLAS_UNITS_AND_DOODADS/{tag}_01.png
	fi
done

```

When I click on it, it will do everything before the :

` aseprite=“C:/Program Files (x86)/Steam/steamapps/common/Aseprite/aseprite.exe”`

[Previous page](https://community.aseprite.org/t/command-batch-save-files-contained-in-a-folder/2092.md?page=1)
