Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 05-09-2015, 04:31 PM   #1
LQ Newbie
Registered: May 2015
Posts: 2

Rep: Reputation: Disabled
Duplicate folder creation while using mkdir in a script


I am setting up a linux server for gaming and I am using a script to update the files automatically and create a folder with a certain name.

# !/bin/bash

# A convenience function, to save us some work
update_server() {
	# Read the app id and the directory into a variable


	# Create the directory ( if it does not exist already )
	if [ ! -d "$HOME/$DIR" ]; then
		mkdir -p "$HOME/$DIR"

	# Uh-oh, it looks like we still have no directory. Report an error.
	if [ ! -d "$HOME/$DIR" ]; then
		# Describe what went wrong
		echo "ERROR! Cannot create directory $HOME/$DIR!"

		# Exit with status code 1 ( which indicates an error )
		exit 1

	# Call SteamCMD with the app ID we provided and tell it to install
	./bin/ +login anonymous +force_install_dir "$HOME/$DIR" +app_update $APP_ID validate +quit

# Now the script actually runs update_server ( which we just declared above ) with the id of the application ( 4020 is Garry's Mod ) and the name of the directory we want the server to be hosted from:

update_server 4020 "gmodserver"

exit 0
When I run this script, it creates 2 folders on my server : gmodserver and gmodserver? There is no files downloaded in gmodserver. All the files are downloaded in gmodserver?

I looked for a few hours on how to solve this problem but I have no idea what the added ? might be so I am lost as to what to look for. Could you help me on figuring this out?

Thank you.

edit : I am using ubuntu 15.04 x64 if it makes a difference.

Last edited by Jephgag; 05-09-2015 at 04:43 PM.
Old 05-09-2015, 06:18 PM   #2
Keith Hedger
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,480

Rep: Reputation: 620Reputation: 620Reputation: 620Reputation: 620Reputation: 620Reputation: 620
The script looks fine, I would say that whaterver app is downloading files to the directory is detecting a folder by the name of 'gmodserver' and so is creating a new one with the '?' added.
Old 05-09-2015, 10:22 PM   #3
LQ Newbie
Registered: May 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
Well this isn't critical, only annoying.

I'll look into it and see if I can find a solution.

I guess the ? sign is only for a duplicate folder (a bit like in windows where it creates a second file as a copy or adds a (2) at the end of the file)?


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
[SOLVED] mkdir: cannot creat directory. How to enable mkdir for user in usb dir? Foxbat1155 Linux - Newbie 13 02-16-2012 12:20 PM
how to give options like '-v' for mkdir using system call mkdir() ? nehapawar Linux - Newbie 2 02-05-2010 03:13 AM
A script within a folder to delete the folder, script, and the folder's contents Cyberman Programming 15 10-17-2007 08:32 AM
duplicate files in one folder! hornung Linux - Enterprise 1 01-13-2005 04:35 PM
mkdir script shelby Programming 3 11-29-2004 04:56 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:32 AM.

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